开发者

How to make array of textboxes accept only specific alphabets?

开发者 https://www.devze.com 2023-02-24 05:59 出处:网络
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 textboxe开发者_JS百科s accept only specific alphabet. . . can any

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 textboxe开发者_JS百科s 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;
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消