有没有vb中text文本框的lostfocus的具体用法演示代码
1个回答
展开全部
Private Sub Command1_Click()
Text4.Text = Val(Text1.Text) + Val(Text2.Text) + Val(Text3.Text)
End Sub
Private Sub Form_Load()
Text1.Text = 0
Text2.Text = 0
Text3.Text = 0
Text4.Text = 0
End Sub
Private Sub Text1_LostFocus()
If Val(Text1.Text) < 0 Or Val(Text1.Text > 100) Then
Text1.Text = ""
Text1.SetFocus
End If
End Sub
Private Sub Text2_LostFocus()
If Val(Text2.Text) < 0 Or Val(Text2.Text > 100) Then
Text2.Text = ""
Text2.SetFocus
End If
End Sub
Private Sub Text3_LostFocus()
If Val(Text4.Text) < 0 Or Val(Text4.Text > 100) Then
Text4.Text = ""
Text4.SetFocus
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询