i am using visual studio c#.net winform and i have 2d array of 81 textboxes. . . i can't figured out how it is possible to make these textboxes accept only specific alphabet. . . can any one please show me the code. . . THanx in advance
private void textBox_KeyPress(object sender, KeyPressEventArgs e)
{
List<char> chrs = new List<char>{'1', '2', '3'};
if (!chrs.Contains(e.KeyChar))
{
e.Handled = true;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.