Hi rani,
Refer below sample. This will check and display message box.
Code
C#
private void txtName_KeyUp(object sender, KeyEventArgs e)
{
if (txtName.Text.Any(char.IsUpper))
{
MessageBox.Show("Please Enter Characters in lowercase!");
txtName.Clear();
}
}
VB.Net
Private Sub txtName_KeyUp(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles txtName.MouseUp
If txtName.Text.Any(AddressOf Char.IsUpper) Then
MessageBox.Show("Please Enter Characters in lowercase!")
txtName.Clear()
End If
End Sub
Screenshot
OR
You can also use below line of code to allow only lowercase characters for type.
C#
txtName.CharacterCasing = CharacterCasing.Lower;
VB.Net
txtName.CharacterCasing = CharacterCasing.Lower