[]
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:
Add a C1TextBox control to your form.
Navigate to C1TextBox’s properties window and change the BorderStyle property to "FixedSingle".
Add a MouseClick event to the C1TextBox control to change C1TextBox’s border color to purple.
To write code in Visual Basic
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#
private void c1TextBox1_MouseClick(object sender, MouseEventArgs e)
{
c1TextBox1.BorderColor = Color.Purple;
}
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
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#
private void c1TextBox1_BorderColorChanged(object sender, EventArgs e)
{
MessageBox.Show("The c1TextBox1 border color changed to purple");
}
This 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.