CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2001
    Location
    Charleston, SC USA
    Posts
    14

    Basic MsgBox question.

    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

  2. #2
    Join Date
    Jun 2001
    Location
    MO, USA
    Posts
    2,868

    Re: Basic MsgBox question.

    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





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured