Link to home
Start Free TrialLog in
Avatar of CRICE
CRICE

asked on

Different forms within a project

I am currently writing a client server application using VB 6.0 and RPG 4 (AS\400).  

I have created a project in VB and have several forms within the project.  Each form is a seperate program.  For example the main form is a list box loaded with records. When the left mouse button is clicked on a record a pop up list of options is displayed.  When an option is selected i pass information from that record into a new form and display the new form.  When the new form is loaded i want processing to remain in that form until the user exits.  At the moment the form loads but processing continues in the calling form.  

Is there a on exit resume next type command?  

Can anyone help??
Avatar of p_biggelaar
p_biggelaar
Flag of Netherlands image

If you don't mind that the user cannot do anything else then work with that form untill he's ready, call the form like this:

YourForm.Show vbModal

This means the form will be shown as modal, and code in the calling form will only continue executing after you unloaded the second form
Simple example:

Create new project, add two forms (Form1, Form2)
On the first form add one commandbutton (command1), on the second add two commandbuttons (command1, command2)

Add this code to Form1:

Private Sub Command1_Click()
    Form2.Show vbModal
    MsgBox "Back to Form1"
End Sub

Add this code to Form2:

Private Sub Command1_Click()
MsgBox "hallo"
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Good luck...
Avatar of CRICE
CRICE

ASKER

Thanks.. that would work for me, as this is exactly what i am trying to do.

The only problem is that i need to pass a varible to the form load routine.  But because it is a private sub, it will not allow this.  I have tried making the varible public, static etc.. but the varible becomes blanks as soon as the form load routine is accessed.
I built an initial sub routine around the form load, but if i show the form in the initial sub routine and use the vbmodal function the form displays but the screen freezes!!

Any ideas?
Avatar of CRICE

ASKER

Thanks.. that would work for me, as this is exactly what i am trying to do.

The only problem is that i need to pass a varible to the form load routine.  But because it is a private sub, it will not allow this.  I have tried making the varible public, static etc.. but the varible becomes blanks as soon as the form load routine is accessed.
I built an initial sub routine around the form load, but if i show the form in the initial sub routine and use the vbmodal function the form displays but the screen freezes!!

Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of p_biggelaar
p_biggelaar
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CRICE

ASKER

Thanks for that... you deserve the points.  As i have not had much experience in VB and i don't get much support from my managers, a web site like this is a god send.  My total VB training has consisted of a book on how to program VB 6.0 in 21 days!!  From this i am suppose to write a client server application using VB and RPG!

Anyway thanks for your time and your help.

Chris
Well, good luck and if you've got any questions, you know what to do...

PS: that really is very little training for what you're supposed to do.