# Showing a Message Box when the Border Color Changes

Learn how to set the calendar drop down in ComponentOne Input for WinForms.

## Content



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.
    
    DOC-DETAILS-TAG-OPEN
    
    DOC-SUMMARY-TAG-OPEN
    
    To write code in Visual Basic
    
    DOC-SUMMARY-TAG-CLOSE
    
    ```vbnet
    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
    ```
    
    DOC-DETAILS-TAG-CLOSE
    
    DOC-DETAILS-TAG-OPEN
    
    DOC-SUMMARY-TAG-OPEN
    
    To write code in C#
    
    DOC-SUMMARY-TAG-CLOSE
    
    ```csharp
    private void c1TextBox1_MouseClick(object sender, MouseEventArgs e)
            {
                c1TextBox1.BorderColor = Color.Purple;
            }
    ```
    
    DOC-DETAILS-TAG-CLOSE
    
4.  Add a **BorderColorChanged** event to C1TextBox1 to show a message box that informs the user the border color has changed.
    
    DOC-DETAILS-TAG-OPEN
    
    DOC-SUMMARY-TAG-OPEN
    
    To write code in Visual Basic
    
    DOC-SUMMARY-TAG-CLOSE
    
    ```vbnet
    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
    ```
    
    DOC-DETAILS-TAG-CLOSE
    
    DOC-DETAILS-TAG-OPEN
    
    DOC-SUMMARY-TAG-OPEN
    
    To write code in C#
    
    DOC-SUMMARY-TAG-CLOSE
    
    ```csharp
    private void c1TextBox1_BorderColorChanged(object sender, EventArgs e)
            {
                MessageBox.Show("The c1TextBox1 border color changed to purple");
            }
    ```
    
    DOC-DETAILS-TAG-CLOSE
    

<br />**![tick](https://cdn.mescius.io/document-site-files/images/6c2f30e9-4d3a-4f86-b649-ecbef777b3a3/images/ticksymbol.png)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.

![textbox](https://cdn.mescius.io/document-site-files/images/6c2f30e9-4d3a-4f86-b649-ecbef777b3a3/images/bordercolor_changes_textbox.png)

## See Also

[Set IME Mode](/componentone/docs/win/online-input/inputforwinformstask/IMEMode)