vb.net中如何限制TextBox只允许输入数字和字母?代码如下:
Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPress
e.Handled = Not "01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".Contains(e.KeyChar)
'如果要只允许输入数字,就把上一行字符串中的字母删除
End Sub