Private Sub Text1_Change()Dim S as stringS=Text1.textIf Len(S)>0 Then If Val(S)<=0 Then Msgbox "请输入一个正整数"End IfEnd Sub
textbox中的值发生变化会触动Change事件Private Sub Text1_Change()End Sub
TextBox Change事件: TextBox的文字发生变化.