ComponentOne Input for WinForms
Input for WinForms Task-Based Help / Showing a Message Box when the Border Color Changes
In This Topic
    Showing a Message Box when the Border Color Changes
    In This Topic

    You can use the BorderColorChanged event when the value of the BorderColor property changes.

    To create a message box when the border color changes for C1TextBox, complete the following:

    1. Add a C1TextBox control to your form.
    2. Navigate to C1TextBox’s properties window and change the BorderStyle property to "FixedSingle".
    3. Add a MouseClick event to the C1TextBox control to change C1TextBox’s border color to purple.

      To write code in Visual Basic

      Visual Basic
      Copy Code
      Private Sub C1TextBox1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles C1TextBox1.MouseClick
          C1TextBox1.BorderColor = Color.Purple
      End Sub
      

      To write code in C#

      C#
      Copy Code
      private void c1TextBox1_MouseClick(object sender, MouseEventArgs e)
              {
       
                  c1TextBox1.BorderColor = Color.Purple;
              }
      
    4. Add a BorderColorChanged event to C1TextBox1 to show a message box that informs the user the border color has changed.

      To write code in Visual Basic

      Visual Basic
      Copy Code
      Private Sub C1TextBox1_BorderColorChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles C1TextBox1.BorderColorChanged
         MessageBox.Show(“The C1TextBox1 border color change to purple”)
      End Sub
      

      To write code in C#

      C#
      Copy Code
      private void c1TextBox1_BorderColorChanged(object sender, EventArgs e)
              {
                  MessageBox.Show("The c1TextBox1 border color changed to purple");
              }
      

    tickThis topic illustrates the following:

    When you mouse click on the C1TextBox control the border color changes to purple. Once it changes to purple the BorderColorChanged event fires and a message box appears informing the user that the border color has changed.

    textbox
    See Also