添加一个文本框,一个ErrorProvider,,当光标离开这个文本框时判断输入的是否是一个数据
代码:
- PrivateSubTextBox1_Validating(ByValsenderAsObject,ByValeAsSystem.ComponentModel.CancelEventArgs)HandlesTextBox1.Validating
- IfNotIsNumeric(TextBox1.Text)Then
- ErrorProvider1.SetError(TextBox1,"Youmustenteranumericvalue.")
- Else
- ErrorProvider1.SetError(TextBox1,"")
- EndIf
- EndSub
'获取当前计算机的相关信息
- Label1.Text=My.Application.Info.Version.ToString()'获取当前应用程序的版本号
- Label1.Text=My.Computer.Name.ToString'获取当前计算机的名称