This is a migrated thread and some comments may be shown as answers.

Textbox border color

1 Answer 520 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
Saikiran
Top achievements
Rank 1
Saikiran asked on 31 May 2011, 02:46 PM
Hi

This is saikiran ,

I want to change the bordercolor of textbox to red while validating data.

Can anyone help me regarding this.


Thanks

Saikiran

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 03 Jun 2011, 08:23 AM
Hi Saikiran,

Thank you for writing.

You can change the border color of the text box by setting the ForeColor property of the BorderPrimitive:
public Form1()
{
    InitializeComponent();
    radTextBox1.Validating += new CancelEventHandler(radTextBox1_Validating);
    radTextBox1.Validated += new EventHandler(radTextBox1_Validated);
}
 
void radTextBox1_Validated(object sender, EventArgs e)
{
    radTextBox1.TextBoxElement.Border.ForeColor = Color.FromArgb(156, 189, 232);  
}
 
void radTextBox1_Validating(object sender, CancelEventArgs e)
{
    radTextBox1.TextBoxElement.Border.ForeColor = Color.Red;
    if (RadMessageBox.Show("Validated", "",  MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No)
    {
        e.Cancel = true;
    }
}

I hope that you find this information helpful. Should you have any other questions, do not hesitate to contact us.
 
All the best,
Stefan
the Telerik team
Q1’11 SP1 of RadControls for WinForms is available for download; also available is the Q2'11 Roadmap for Telerik Windows Forms controls.
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
Saikiran
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or