DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 14 of 14

Thread: help for 'ON ERROR' statement....

  1. #1
    Join Date
    Nov 2008
    Posts
    7

    help for 'ON ERROR' statement....

    hi all

    [Run-time error 339: Component 'xxxxxxx.OCX' or one of its dependencies not correctly registerd: a file is missing or invalid.]

    i know why this error happend..
    but i need this error in my app. and dont want to show this error

    if i am using 'ON ERROR GOTO' command... but doesn't work....
    below is my code:

    ON ERROR GOTO EH:

    --------------codeing----
    --------------codeing------

    EH:
    msgbox "Pls contact developer"
    end

    *************so pls help anybody very soon********

  2. #2
    Join Date
    Mar 2008
    Location
    Lancashire, UK
    Posts
    156
    If you just want to hide the error from the user, comment out the MsgBox statement.
    If the On Error statement doesn't work and you get the runtime error message box, could you post more of the code, so we can see what's going on?

    And you should never use End. It's very bad, you should unload everything from memory properly.

  3. #3
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Welcome to DevX

    The way to get rid of the error is to properly register the component.

    What installation and setup package are you using?

  4. #4
    Join Date
    Nov 2008
    Posts
    7
    Quote Originally Posted by CptNeutral
    If you just want to hide the error from the user, comment out the MsgBox statement.
    If the On Error statement doesn't work and you get the runtime error message box, could you post more of the code, so we can see what's going on?

    And you should never use End. It's very bad, you should unload everything from memory properly.
    ************

    thanx for ur instant assist...

    actually, i'm an application developer. i'm using third-party component tool... i need my app. software as copyright... so nobody knows which type of component use my app-software. Because somebody try to copy my exe file and put other meachine and installed vb6 and work... so i'm using this thirdparty component... it shows this runtime error without use of 'ON ERROR STATEMENT', and also shows which type of component file use... like the runtime error 339.

    so my startup form is as like below: (and i'm use thirdparty grid control for security) so that i check and terminate my exe file for unauthorized person.

    '*********************
    Private Sub Form_Initialize()
    On Error GoTo eh
    Exit Sub
    eh:
    MsgBox "Pls Contact Software Developer", vbExclamation
    End
    End Sub
    '********************

    but the above code doesn't work 'ON ERROR GOTO'

    thanx for advance
    sam.

  5. #5
    Join Date
    May 2008
    Posts
    37
    why not trap the error code instead of using on error ?

    something like this :
    Code:
    result = doThis()
    if result = 339 then
       msgbox "warning"
       end
    else
       {the rest of your code goes here}
    endif
    just my two cents worth ...

    cheers !!!
    BASED FROM YOUR POSTS, I HAVE EXAMINED YOUR BEHAVIORAL PATTERN AND I SAW YOUR BRAIN'S TWO SIDES : LEFT & RIGHT, AND I SAW THAT ON THE LEFT SIDE THERE'S NOTHING RIGHT WHILE ON THE RIGHT SIDE THERE'S NOTHING LEFT

  6. #6
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    A lot of times, those type of errors actually ignore the error trap and you still wind up with a run time that blows the user back to the desktop.

    In this instance, again, I believe the best solution is to simply ensure the component gets properly registered.

  7. #7
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Quote Originally Posted by sam2008
    but the above code doesn't work 'ON ERROR GOTO'
    Quote Originally Posted by Hack
    A lot of times, those type of errors actually ignore the error trap
    And I believe that is what is happening here.

  8. #8
    Join Date
    Nov 2008
    Posts
    7
    Quote Originally Posted by jamesbandido
    why not trap the error code instead of using on error ?

    something like this :
    Code:
    result = doThis()
    if result = 339 then
       msgbox "warning"
       end
    else
       {the rest of your code goes here}
    endif
    just my two cents worth ...

    cheers !!!
    **********
    thanx 2 u
    sorry the above code is doesnt work...
    whats this command ' dothis() '
    ***********

    actualy my requirment is as below:
    some unauthorized/illegal persons copy my app.exe file, database access file and all crystal report files copy and paste in any other meacine and installed vb6, then work my app.software without my legalpermission....
    so i cant give full licence to my app.software...
    so that i can do one logic that is i add one third pary component to my startupform and must not show this runtime error339 whenever those try to execute the exefile in any another meachine.... or is any other way to protect and full security to my app.....

    thanks a loooooooot for ur help

  9. #9
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Does the same thing happen with legal copies of the software package?

  10. #10
    Join Date
    Nov 2008
    Posts
    7
    Quote Originally Posted by Hack View Post
    Does the same thing happen with legal copies of the software package?
    No.... In my legal copy of the software package there is no runtime error... Its work good and without any errors.

    So i need error only if try to copy my exe file without my permission....

    thanks a looooooooooooooootooooo Mr. Hack.

  11. #11
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    If someone tries to just copy the exe without doing a formal installation, they will get all kinds of errors all on their own without you having to do anything.

  12. #12
    Join Date
    Nov 2008
    Posts
    7
    Quote Originally Posted by Hack View Post
    If someone tries to just copy the exe without doing a formal installation, they will get all kinds of errors all on their own without you having to do anything.
    i know ur answer...

    but they can installed VisualBasic 6.0. so those will not get all kind of errors.

    so what can i do this situation?? pls help me

  13. #13
    Join Date
    Mar 2008
    Location
    Lancashire, UK
    Posts
    156
    So basically, you want to stop people who just copy your program from using it?
    Why not use a serial/key generator or something?

  14. #14
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Does your application use a database?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center