Results 1 to 2 of 2

Thread: error handler mistak

  1. #1

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    error handler mistak

    im writing an error handler for filing operation, but the problem is that the handler executes whether or not there was an error, here is da code

    Code:
    Private Sub Command1_Click()
    
    Dim currentLine, id, pwd, arr
    
        On Error GoTo errHandler
        Open App.Path & "\info.txt" For Input As #1
        
        Do Until EOF(1)
            Line Input #1, currentLine
            arr = Split(currentLine, "=")
            If LCase(arr(0)) = "username" Then
                id = arr(1)
            ElseIf LCase(arr(0)) = "password" Then
                pwd = arr(1)        
        Loop
        
        MsgBox id & " " & pwd & " " & phone
    
        
    errHandler:
        MsgBox "File not verified"
        End
        
    End Sub

  2. #2
    Next Of Kin baja_yu's Avatar
    Join Date
    Aug 2002
    Location
    /dev/root
    Posts
    5,989

    Re: error handler mistak

    Add

    ExitSub

    before the errHandler:

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