代码只允许在文本框中输入文本,如果输入数字或其他字符,则在 msgbox 中显示“错误”
这是我的代码:
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
NA = Val(TextBox1.Text)
If NA > 0 Then
MsgBox("Error")
Else
NA = Val(TextBox1.Text)
End If
End Sub