Results 1 to 3 of 3

Thread: Msgbox messages

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2002
    Posts
    157

    Msgbox messages

    Open "c:\Address.dat" For Input As #1
    Do Until EOF(1)
    i% = i% + 1
    If Text1.Text = "" Then Exit Do
    If i% > UBound(Names$) Then ReDim Preserve Names$(1 To i%)
    If i% > UBound(Adds$) Then ReDim Preserve Adds$(1 To i%)
    Input #1, Names$(i%), Adds$(i%)
    If Text1.Text = Names$(i%) Then
    Text1.Text = Names$(i%)
    Text2.Text = Adds$(i%)
    Else
    msg = "NOT There"
    response = MsgBox(msg, vbOKOnly, "Attention")
    End If
    Loop
    Close #1

    HERE I WOULD LIKE TO INFORM YOU THAT IF I DON' TYPE THE
    NAME CORRECTLY OR NO NAME FOUND I WANT MSG TO BE
    DISPLAYED HOW DO I DO IT WHEN I PRESS OK THE MSGBOX SHOULD DISAPPEAR

    REGDS
    SAM F

  2. #2
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068
    msgbox

    ??

    Edited to add~~~~~~

    Oh I see what you mean... You need to exit the loop in order for the message boxes to stop popping up when they click OK

    VB Code:
    1. Open "c:\Address.dat" For Input As #1
    2. Do Until EOF(1)
    3. i% = i% + 1
    4. If Text1.Text = "" Then Exit Do
    5. If i% > UBound(Names$) Then ReDim Preserve Names$(1 To i%)
    6. If i% > UBound(Adds$) Then ReDim Preserve Adds$(1 To i%)
    7. Input #1, Names$(i%), Adds$(i%)
    8. If Text1.Text = Names$(i%) Then
    9. Text1.Text = Names$(i%)
    10. Text2.Text = Adds$(i%)
    11. Else
    12. msg = "NOT There"
    13. response = MsgBox(msg, vbOKOnly, "Attention")
    14. Exit Sub
    15. End If
    16. Loop
    17. Close #1
    Last edited by Spajeoly; Jun 4th, 2004 at 11:09 AM.

  3. #3
    Frenzied Member Spajeoly's Avatar
    Join Date
    Mar 2003
    Location
    Utah
    Posts
    1,068
    VB Code:
    1. Open "c:\Address.dat" For Input As #1
    2.  Do Until EOF(1)
    3.   i% = i% + 1
    4.     If Text1.Text = "" Then Exit Do
    5.        If i% > UBound(Names$) Then ReDim Preserve Names$(1 To i%)
    6.            If i% > UBound(Adds$) Then ReDim Preserve Adds$(1 To i%)
    7.            Input #1, Names$(i%), Adds$(i%)
    8.              If Text1.Text = Names$(i%) Then
    9.                 Text1.Text = Names$(i%)
    10.                 Text2.Text = Adds$(i%)
    11.     Else
    12.         msg = "NOT There"
    13.         MsgBox "NOT There" vbOKOnly, "Attention"
    14.           Close #1
    15.           Exit Sub
    16.     End If
    17. Loop
    18. Close #1

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