Here is the example code:
Private Sub Command1_Click()
Load Form2
End Sub
Private Sub Command2_Click()
Unload Form2
End Sub
I performed the test above because I have a main menu form that loads a
form via a command_click (the form remains hidden) and the form is unloaded
using an unload statement. I've tried the unload statement within the
hidden form and the main menu that called it, but the results are the same.
Any ideas are much welcomed!
Thxs in advance!
What you describe should work no problem, I suspect that somewhere else in
your code (perhaps in Form2 itself) is where the error is occuring.
To test this, start a new project and add another form so you have Form1 and
Form2.
Then add two command buttons and cut and paste your code below into form1.
Run the project - it should work just fine.
Doug.
Cliff Bailey wrote in message
<#5t3Tw8S#GA....@uppssnewspub04.moswest.msn.net>...
It is at Page 371 of my Vb5 VB Programmers's Guide.
For Vb6 it is buried away at:
MSDN Library Visual Studio 6.0
Visual Basic Documentation
Using Visual basic
Programmer's Guide (All Editions)
Part 2: What Can You Do With Visual Basic?
Programming with Objects
Creating Your Own Classes
Life Cycle of Visual Basic Forms
It's a good read!
Barry Evans
Canberra, Australia
----------------------------
Rob R. Ainscough wrote in message ...
You're right, this should work just fine! I did exactly your suggestion
before I posted this problem that I was experiencing. I would get the
run-time error in Form1 (Command_Click for the 'load Form2).
The bizarre thing is, I'm not receiving the error now with the same exact
code (I feel like I'm loosing my mind). I would have never posted this if
I wasn't totally suprized. I will have to continue testing this throughout
the day. The only difference between now and then is a system re-boot.
Thanks again,
Cliff
Douglas Marquardt wrote in message
<#ZYL8P9S#GA....@uppssnewspub05.moswest.msn.net>...
>Hi Cliff:
>
>What you describe should work no problem, I suspect that somewhere else in
>your code (perhaps in Form2 itself) is where the error is occuring.
>
>To test this, start a new project and add another form so you have Form1
and
>Form2.
>Then add two command buttons and cut and paste your code below into form1.
>Run the project - it should work just fine.
>
>Doug.
>
>