Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Buttons, RadioButton, CheckBox, etc > Textbox border color

Not answered Textbox border color

Feed from this thread
  • Saikiran avatar

    Posted on May 31, 2011 (permalink)

    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

    Reply

  • Stefan Stefan admin's avatar

    Posted on Jun 3, 2011 (permalink)

    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.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Buttons, RadioButton, CheckBox, etc > Textbox border color
Related resources for "Textbox border color"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]