谢谢您的解答!
试了下,这段语句只能判断文本框(TextBox1)是否输入了数字,不能判断窗体内其他文本框(比如TextBox2、TextBox3……是否输入了数字)。从其他网站上搜到下列子过程,可以解决这个问题,供大家参考。
Public Class form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Call IsExists(Me)
End Sub
Public Sub IsExists(ByVal frmTestText As Windows.Forms.Form)
Dim c As Control
For Each c In frmTestText.Controls
If TypeOf c Is TextBox Then
c.Text = c.Text.Trim
If c.Text = "" Or Not IsNumeric(c.Text) Then
c.Text = ""
MsgBox("输入数据有误,请重新输入 !")
c.Focus()
Exit Sub
End If
End If
Next
End Sub
End Class