vb怎么使用lostfocus进行输入数据的检测
2个回答
展开全部
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
展开全部
vb用folsttiecs进入检测重心切换lostfocus输入数据就可以了
追答
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) 100) Then
Text1.Text = ""
Text1.SetFocus
End If
End Sub
Private Sub Text2_LostFocus()
If Val(Text2.Text) 100) Then
Text2.Text = ""
Text2.SetFocus
End If
End Sub
Private Sub Text3_LostFocus()
If Val(Text4.Text) 100) Then
Text4.Text = ""
Text4.SetFocus
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询