TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Shovan Saha
NA
321
91.9k
C# text box 11 digit only
Apr 28 2017 10:06 AM
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)
Reply
Answers (
4
)
Disable picture box which is dynamically created
perst projects or example