Results 1 to 6 of 6

Thread: On Error Resume next wont work... and others

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Oct 2006
    Posts
    20

    On Error Resume next wont work... and others

    Yo, first off "On Error Resume Next" won't work sometimes, why do peeps keep using it? I have downloaded code that works sometimes and sometimes it doesn't... which is said to work fine.

    Also, I am doing an IDE imitation for my Fi - Game Maker proyect (www.lainmaster.tk, if interested), and I want to do the Drop Down List Poput thingy that shows all the properties, methods and functions of an object. I will use CallByName since my proyect will come with some DLLs I made, and parsing the code (or parseing?) would be too much work AND even if i decide so, I want to know how the heck the VB IDE does that. I made a DLL explorer thingy some time ago but i forgot how to do it now, hehe, but it only worked for like 5% of the DLLs in windows/system32/...

    And finally, how do I check if that property, method, function, mikey mouse, or whatever, exists in that object? I mean, the CallByName uses Err.Raise to show the box If something happens, what does this function actually ask when it comes to either doing it or showing the Err.Raise thing?

    Thanks=)

  2. #2
    Banned randem's Avatar
    Join Date
    Oct 2002
    Location
    Maui, Hawaii
    Posts
    11,385

    Re: On Error Resume next wont work... and others

    It always works...Sometimes not like you expect it to if not used properly.

    Show your code...

  3. #3
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: On Error Resume next wont work... and others

    Show your own error code then.

    VB Code:
    1. On Error GoTo ErrorMessage
    2.       'Some Code Here
    3.       Exit Sub '<----------Dont Forget this!
    4. ErrorMessage:
    5.       MsgBox "An error has occured!" & vbcrlf & vbcrlf & Err.Description, VbOkOnly + VbExclaimation, "Error: " & Err.Number
    My usual boring signature: Something

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: On Error Resume next wont work... and others

    unless you know what error you are going to get and want to ignore it then you should not use on error resume next, if one line in the sub has an error that often makes the rest of the sub meaningless, also it becomes impossible to debug your code with if errors are ignored
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    Re: On Error Resume next wont work... and others

    How you've set up the error trapping in the IDE will also make a difference.

  6. #6

    Thread Starter
    Junior Member
    Join Date
    Oct 2006
    Posts
    20

    Re: On Error Resume next wont work... and others

    For example...

    Dim A As Byte
    On Error Resume NExt
    A=500

    Sometimes shows the "error!" dialog and sometimes doesn't... in other words... omg i think maybe i changed VB IDE options to look for errors at compile... but the on error behaviour (however you spell that) at EXEs is pretty random... i bet it's cuz sometimes it checks out if it's gonna have an error before storing the code in memory =P whatever, On Error sucks and it's gay.

    I'ma learn C++ this summer hahaha, anyways, this topic wasn't about the on error thingy.

    ------------

    The TypeLib thing helped me out with the other part. I guess it only accepts ActiveX DLLs and not standar DLLs, with it I can know almost everything about a DLL, it's classes, methods, properties, etc, up to know I only have this problem:
    I can't know if something is a function or sub, guess it's a sub when no return type is specified and VB changed automatically to Variant if not specified in the IDE

    Also, i was expecting to be able to know the current proyect's data on mothods, classes, etc... but well whatever... I think I will chose paresing stuff=P It will give me more freedom on handleing everything

    About the On Error Resume/GoTo/BlaBla...
    I just wanted to know if there was a way of knowing EVERYTHING like every possible value for a variable (so we never generate an overflow)... but for the APIs or DLLs... well maybe it's not possible since maybe the DLL uses a private function to determine if an error.raise should be used or not....

    BTW "GoTo" is also crappy.... and should not be used.

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