private void txtReceiverContact_TextChanged(object sender, EventArgs e)
{
if (System.Text.RegularExpressions.Regex.IsMatch(txtReceiverContact.Text, " ^ [0-9]"))
{
txtReceiverContact.Text = "";
}
}
private void txtReceiverContact_KeyPress(object sender, KeyPressEventArgs e)
{
string senderText = (sender as TextBox).Text;
string senderName = (sender as TextBox).Name;
int cursorPosition = (sender as TextBox).SelectionStart;
if (!char.IsControl(e.KeyChar)
&& !char.IsNumber(e.KeyChar))
{
e.Handled = true;
}
}
== When I will press any letter, message box will appear and show "Input Digit Only!"
== Digt will not be more than 11 (Eleven)
Amit GuptaPosted Apr 28, 2017, 10:36 AM
Rafnas T PPosted Apr 29, 2017, 12:51 AM
Khaja MoizuddinPosted Apr 28, 2017, 1:21 PM
Bryian TanPosted Apr 28, 2017, 10:15 AM