illegal operatin when exiting


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 9 of 9

Thread: illegal operatin when exiting

  1. #1
    Rachel Guest

    illegal operatin when exiting


    When I try to exit my program at certain points, after it shuts down, i get
    an
    "Illegal Operation - this program will be shut down" message. (Invalid page
    fault at kernel32.dll)

    I don't know what to look for that may be causing this. Its only when I
    exit. My exit is only had "end" in the procedure.

    Could someone tell me the sort of things I should look for that may be
    causing this type of error?

    Rachel



  2. #2
    Bill Hershey Guest

    Re: illegal operatin when exiting


    Rachel,

    Try removing the End statement, then exit the program in the development
    enviroment. If the program does not completly shut down without the End statement,
    your leaving an object or other reference open. You should not need and End
    statement at all to stop your program. Set all your objects to Nothing, unload
    all your forms, and set all forms to nothing and you should get a clean exit.


    Set MyObject = Nothing
    Unload MyForm
    Set MyForm = Nothing


    "Rachel" <taurusco@ntelos.net> wrote:
    >
    >When I try to exit my program at certain points, after it shuts down, i

    get
    >an
    >"Illegal Operation - this program will be shut down" message. (Invalid page
    >fault at kernel32.dll)
    >
    >I don't know what to look for that may be causing this. Its only when I
    >exit. My exit is only had "end" in the procedure.
    >
    >Could someone tell me the sort of things I should look for that may be
    >causing this type of error?
    >
    >Rachel
    >
    >



  3. #3
    Arthur Wood Guest

    Re: illegal operatin when exiting


    Rachel,
    It is very tempting to use the END statement in your program, but that
    is VERY VERY poor programming style. It is the logical equivalent of stopping
    your car by smashing it into a Brick wall, rather than applying the brakes.
    Both processes will in fact stop the car, but the first way also has the
    unpleasnt side effect of killing the driver, and leaving the car in less
    than usable condition.

    If you terminate your program by simply unloading the last form, when it
    runs as an Executable, it will shut down properly and clean up after itself
    as it closes the door. If you use the End statement, you program will commit
    suicide and will not have a change to clean up after itself, much less close
    the doors.

    Arthur Wood

    "Rachel" <taurusco@ntelos.net> wrote:
    >
    >When I try to exit my program at certain points, after it shuts down, i

    get
    >an
    >"Illegal Operation - this program will be shut down" message. (Invalid page
    >fault at kernel32.dll)
    >
    >I don't know what to look for that may be causing this. Its only when I
    >exit. My exit is only had "end" in the procedure.
    >
    >Could someone tell me the sort of things I should look for that may be
    >causing this type of error?
    >
    >Rachel
    >
    >



  4. #4
    Rachel Guest

    Re: illegal operatin when exiting

    I've tried unloading all forms, setting them to nothing and any databases
    that could possibly still be open, but it still doesn't shut down when i
    exit this way. I don't know what object is still open. Its like trying to
    find a needle in a haystack.

    Could it be a common dialague control?

    Is there something I'm supposed to do with the common dialogue control after
    I've finished using it?

    Rachel



    Bill Hershey <bhershey@uswestmil.net> wrote in message
    news:3a8a1e60$1@news.devx.com...
    >
    > Rachel,
    >
    > Try removing the End statement, then exit the program in the development
    > enviroment. If the program does not completly shut down without the End

    statement,
    > your leaving an object or other reference open. You should not need and

    End
    > statement at all to stop your program. Set all your objects to Nothing,

    unload
    > all your forms, and set all forms to nothing and you should get a clean

    exit.
    >
    >
    > Set MyObject = Nothing
    > Unload MyForm
    > Set MyForm = Nothing
    >
    >
    > "Rachel" <taurusco@ntelos.net> wrote:
    > >
    > >When I try to exit my program at certain points, after it shuts down, i

    > get
    > >an
    > >"Illegal Operation - this program will be shut down" message. (Invalid

    page
    > >fault at kernel32.dll)
    > >
    > >I don't know what to look for that may be causing this. Its only when I
    > >exit. My exit is only had "end" in the procedure.
    > >
    > >Could someone tell me the sort of things I should look for that may be
    > >causing this type of error?
    > >
    > >Rachel
    > >
    > >

    >




  5. #5
    Rachel Guest

    Re: illegal operatin when exiting

    I found the problem. I have a procedure in my form load event :

    Call frmCosts.ReadtheRegistry

    to get some values from some text boxes on that form which i use in the main
    form.

    but when I put

    set frmCosts = nothing

    in my main form's unload procedure, it still will not end the program.

    If i dim out the Call frmCosts.ReadtheRegistry, procedure from my form load
    procedure, then the program will end with my unload procedure with out an
    end statement. But i need to get those values at some point. Is there some
    other way to set that form so it doesn't interfere with my unloading
    procedure?

    Rachel






    Bill Hershey <bhershey@uswestmil.net> wrote in message
    news:3a8a1e60$1@news.devx.com...
    >
    > Rachel,
    >
    > Try removing the End statement, then exit the program in the development
    > enviroment. If the program does not completly shut down without the End

    statement,
    > your leaving an object or other reference open. You should not need and

    End
    > statement at all to stop your program. Set all your objects to Nothing,

    unload
    > all your forms, and set all forms to nothing and you should get a clean

    exit.
    >
    >
    > Set MyObject = Nothing
    > Unload MyForm
    > Set MyForm = Nothing
    >
    >
    > "Rachel" <taurusco@ntelos.net> wrote:
    > >
    > >When I try to exit my program at certain points, after it shuts down, i

    > get
    > >an
    > >"Illegal Operation - this program will be shut down" message. (Invalid

    page
    > >fault at kernel32.dll)
    > >
    > >I don't know what to look for that may be causing this. Its only when I
    > >exit. My exit is only had "end" in the procedure.
    > >
    > >Could someone tell me the sort of things I should look for that may be
    > >causing this type of error?
    > >
    > >Rachel
    > >
    > >

    >




  6. #6
    Rachel Guest

    Re: illegal operatin when exiting

    Just wanted to thank everyone who helped here. I finally have my program
    exiting correctly. Apparently needed to unload again as well as set it
    nothing. Now when i make the distributed disk, it no longer gives the
    illegal operation message when I shut down.

    All this time i've been learning VB, I never knew you weren't supposed to
    use the END statement for exiting. I guess it never came up before. I am
    curious though if anyone feels like responding to this, when if ever you do
    put the end statement in your program.

    Thanks
    Rachel


    Bill Hershey <bhershey@uswestmil.net> wrote in message
    news:3a8a1e60$1@news.devx.com...
    >
    > Rachel,
    >
    > Try removing the End statement, then exit the program in the development
    > enviroment. If the program does not completly shut down without the End

    statement,
    > your leaving an object or other reference open. You should not need and

    End
    > statement at all to stop your program. Set all your objects to Nothing,

    unload
    > all your forms, and set all forms to nothing and you should get a clean

    exit.
    >
    >
    > Set MyObject = Nothing
    > Unload MyForm
    > Set MyForm = Nothing
    >
    >
    > "Rachel" <taurusco@ntelos.net> wrote:
    > >
    > >When I try to exit my program at certain points, after it shuts down, i

    > get
    > >an
    > >"Illegal Operation - this program will be shut down" message. (Invalid

    page
    > >fault at kernel32.dll)
    > >
    > >I don't know what to look for that may be causing this. Its only when I
    > >exit. My exit is only had "end" in the procedure.
    > >
    > >Could someone tell me the sort of things I should look for that may be
    > >causing this type of error?
    > >
    > >Rachel
    > >
    > >

    >




  7. #7
    Arthur Wood Guest

    Re: illegal operatin when exiting


    Rachel,

    "when if ever you do you put the end statement in your program?"


    That has a VERY simple answer ---> NEVER!!!!

    unless you want the program to commit suicide.

    Arthur Wood


    "Rachel" <taurusco@ntelos.net> wrote:
    >Just wanted to thank everyone who helped here. I finally have my program
    >exiting correctly. Apparently needed to unload again as well as set it
    >nothing. Now when i make the distributed disk, it no longer gives the
    >illegal operation message when I shut down.
    >
    >All this time i've been learning VB, I never knew you weren't supposed to
    >use the END statement for exiting. I guess it never came up before. I am
    >curious though if anyone feels like responding to this, when if ever you

    do
    >put the end statement in your program.
    >
    >Thanks
    >Rachel
    >
    >
    >Bill Hershey <bhershey@uswestmil.net> wrote in message
    >news:3a8a1e60$1@news.devx.com...
    >>
    >> Rachel,
    >>
    >> Try removing the End statement, then exit the program in the development
    >> enviroment. If the program does not completly shut down without the End

    >statement,
    >> your leaving an object or other reference open. You should not need and

    >End
    >> statement at all to stop your program. Set all your objects to Nothing,

    >unload
    >> all your forms, and set all forms to nothing and you should get a clean

    >exit.
    >>
    >>
    >> Set MyObject = Nothing
    >> Unload MyForm
    >> Set MyForm = Nothing
    >>
    >>
    >> "Rachel" <taurusco@ntelos.net> wrote:
    >> >
    >> >When I try to exit my program at certain points, after it shuts down,

    i
    >> get
    >> >an
    >> >"Illegal Operation - this program will be shut down" message. (Invalid

    >page
    >> >fault at kernel32.dll)
    >> >
    >> >I don't know what to look for that may be causing this. Its only when

    I
    >> >exit. My exit is only had "end" in the procedure.
    >> >
    >> >Could someone tell me the sort of things I should look for that may be
    >> >causing this type of error?
    >> >
    >> >Rachel
    >> >
    >> >

    >>

    >
    >



  8. #8
    mrfelis Guest

    Re: illegal operatin when exiting

    When writting GW-Basic programs. Or Z-Basic or M-Basic, or any other ancient
    MS babic program.

    --
    ~~~
    !ti timda I ,KO
    ..em deppals nocaeB sivaM
    !draH
    ~~
    C'Ya,
    mrfelis@yahoo!com
    Rachel <taurusco@ntelos.net> wrote in message news:3a8bf00e@news.devx.com...
    > Just wanted to thank everyone who helped here. I finally have my program
    > exiting correctly. Apparently needed to unload again as well as set it
    > nothing. Now when i make the distributed disk, it no longer gives the
    > illegal operation message when I shut down.
    >
    > All this time i've been learning VB, I never knew you weren't supposed to
    > use the END statement for exiting. I guess it never came up before. I am
    > curious though if anyone feels like responding to this, when if ever you

    do
    > put the end statement in your program.
    >
    > Thanks
    > Rachel
    >
    >
    > Bill Hershey <bhershey@uswestmil.net> wrote in message
    > news:3a8a1e60$1@news.devx.com...
    > >
    > > Rachel,
    > >
    > > Try removing the End statement, then exit the program in the development
    > > enviroment. If the program does not completly shut down without the End

    > statement,
    > > your leaving an object or other reference open. You should not need and

    > End
    > > statement at all to stop your program. Set all your objects to Nothing,

    > unload
    > > all your forms, and set all forms to nothing and you should get a clean

    > exit.
    > >
    > >
    > > Set MyObject = Nothing
    > > Unload MyForm
    > > Set MyForm = Nothing
    > >
    > >
    > > "Rachel" <taurusco@ntelos.net> wrote:
    > > >
    > > >When I try to exit my program at certain points, after it shuts down, i

    > > get
    > > >an
    > > >"Illegal Operation - this program will be shut down" message. (Invalid

    > page
    > > >fault at kernel32.dll)
    > > >
    > > >I don't know what to look for that may be causing this. Its only when I
    > > >exit. My exit is only had "end" in the procedure.
    > > >
    > > >Could someone tell me the sort of things I should look for that may be
    > > >causing this type of error?
    > > >
    > > >Rachel
    > > >
    > > >

    > >

    >
    >




  9. #9
    Chris Lucas Guest

    Re: illegal operatin when exiting


    "Rachel" <taurusco@ntelos.net> wrote:
    >Just wanted to thank everyone who helped here. I finally have my program
    >exiting correctly. Apparently needed to unload again as well as set it
    >nothing. Now when i make the distributed disk, it no longer gives the
    >illegal operation message when I shut down.
    >
    >All this time i've been learning VB, I never knew you weren't supposed to
    >use the END statement for exiting. I guess it never came up before. I am
    >curious though if anyone feels like responding to this, when if ever you

    do
    >put the end statement in your program.
    >
    >Thanks
    >Rachel


    Racheal,

    I use the END statement only if I'm afraid further program execution will
    do damage to other components my code interacts with. For instance, when
    I handle an error in code that is writing to our corporate database, I
    prefer END to other methods. This may be considered sloppy by some, but
    Not corrupting sensative data is more important.

    Chris

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