Click to See Complete Forum and Search --> : Basic MsgBox question.


dlaramee
September 26th, 2001, 02:10 PM
I'm studying the basics of VB6 programming, but the manual doesn't give a clear example of how to make a message box pop up ON FOCUS.
I have 2 text boxes, number1 and number2, which equal textbox numbersum. If numbersum = 0.5 or greater, I want a message box to pop up when that text box becomes focused.
Please tell me how to do this.

Many thanks.


Dave

DSJ
September 26th, 2001, 02:49 PM
Open a new project, place on three textboxes and add this code, as soon as textbox3 three gets focus, the code will run...


option Explicit

private Sub Text3_GotFocus()
If IsNumeric(Text1.Text) And IsNumeric(Text2.Text) then
Text3.Text = Val(Text1.Text) + Val(Text2.Text)
End If
If Val(Text3.Text) > 0.5 then
MsgBox "It's about .5", vbOKOnly
End If
End Sub