| Input for WinForms Task-Based Help > Showing a Message Box when the Border Color Changes |
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:
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;
}
|
|
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");
}
|
|
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.