Results 1 to 5 of 5

Thread: Errors[resolved]

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787

    Errors[resolved]

    Ok i'm trying to trap the incorrect path error but this code allways displays the error evan if the image is loaded!

    VB Code:
    1. Private Sub CmdLoad_Click()
    2. On Error GoTo handler:
    3.  
    4. OriginPic.Cls
    5. OriginPic.Picture = LoadPicture(txtPath.Text)
    6. OriginPic.Refresh
    7.  
    8. handler: MsgBox "Please Make sure Path IS Correct"
    9. End Sub
    Last edited by Pino; Aug 13th, 2004 at 07:56 AM.

  2. #2
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    Exit Sub right before the handler label

  3. #3
    Hyperactive Member Jlarini's Avatar
    Join Date
    Jan 2002
    Location
    São Paulo, Brazil
    Posts
    263
    Pino,

    it's a too basic error... sorry...


    VB Code:
    1. Private Sub CmdLoad_Click()
    2. On Error GoTo handler:
    3.  
    4. OriginPic.Cls
    5. OriginPic.Picture = LoadPicture(txtPath.Text)
    6. OriginPic.Refresh
    7.  
    8. [b]exit sub[/b]   '<--- it's missing...
    9.  
    10. handler: MsgBox "Please Make sure Path IS Correct"
    11. End Sub

    JL
    nothing is impossible, it's sometimes very hard to do!

    If your thread is solved... Please edit it and add [Resolved] or [Solved] on it!

    If you like Marine aquarium, feel free to PM me.

    Sorry my bad English

    God bless Parksie!

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Dec 2003
    Posts
    4,787
    your right that was too basic, i think its time i left the computer alone for a bit thanks guys

  5. #5
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629
    And for multi error handling...
    VB Code:
    1. On Error Goto Sample1
    2. 'blah blah
    3.  
    4. On Error Goto Sample2
    5. 'blah blah
    6.    Exit Sub/Function
    7.  
    8. Sample1:
    9.    'handle
    10.    'Err.Clear
    11.    Exit Sub/Function
    12.  
    13. Sample2
    14.    'handle
    15.    'Err.Clear
    16.    Exit Sub/Function

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