Hi,
I am trying toload a form like this,But getting error.I want to load form and kept in memory.Any one know this how to do?
Load Form1 ? 'Getting error
Thanks.
Printable View
Hi,
I am trying toload a form like this,But getting error.I want to load form and kept in memory.Any one know this how to do?
Load Form1 ? 'Getting error
Thanks.
If I understand what you mean try.
form1.show vbmodal, me
this will 'load' a form.
If, when you do
Load Form1
you get an error then you should look at the form's Load event to see what code is being executed.
If you still can't see the error in the code, then set a breakpoint (F9) on the "Load Form1" line, and run the program.
When the program stops at the breakpoint use 'stepping' (F8) to step through each line of the load event until the error appears. That should help.
Form1.Show will load the form before showing it, so you should get the same error if you do this.
I am explaining my requirement again.
I have two forms Form1 and Form2.
In Form1 load event I said Load form2.My thinking is when I run this program it has to show form1 and load Form2 but don't show me keep it in memory.
Now can you tell me can I do this?
I have no idea why you would want to do this but try this.
in form1 onload event
VB Code:
form2.show vbmodal, form1
in form2 onload event
VB Code:
form2.hide
would that work?
Ok the load function loads objects into memory. So if you use the following syntax ( load form1) then the form will be loaded into memory and not displayed. I just tried it in my IDE(VB) and it works fine. There must be other problems with your first form. Try opening a new project and then create a second form and place a button on the first form.
In the load event of the first form place the following code
load form1 then in the click event for the button place the following code form1.show. If this all works fine then there is another problem and i would suggest using break on all errors in the options window. or use F9 to step through it.