Textbox border color

2 posts, 0 answers
  1. Saikiran
    Saikiran avatar
    7 posts
    Member since:
    May 2011

    Posted 31 May 2011 Link to this post


    This is saikiran ,

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

    Can anyone help me regarding this.



  2. Stefan
    Stefan avatar
    2891 posts

    Posted 03 Jun 2011 Link to this post

    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()
        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,
    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.
  3. DevCraft R3 2016 release webinar banner
Back to Top