954,568 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Jump from code in one form to another. VB6

Hi All,

I would like to start by saying that what I want to do is probably against the rules but I thought I would try and find out if it could be done.

I am creating a VB program where you fill out a form "FORM1" and then select "print" or "exit" if you select print another form appears prompting you to log on "FORM2". The code on this form checks to see if you are an approved user and if so finds the task record associated with the information you have entered in form 1, if it finds more than one task another form FORM 3 opens so the user can select the task he needs.

What I would like to do is when the user has selected the task he needs - This is achieved by clicking select - I would like to return to the point in the code of FORM 2 just after
FORM3.SHOW

I have tried by adding the following at the end of the "on click "command code for select in form 3 Goto Continue


and adding

Continue:

at the point in Form2 that I want to return to. Sadly this doesnt work


Any ideas would be gratefully appreciated.

lisheen
Newbie Poster
12 posts since Apr 2008
Reputation Points: 10
Solved Threads: 0
 

Hi,

If you want to Jump to another form, Create a Public Procedure in the new Form, and call the Procedure, write the codes in the new proc. Once the code is executed, the excution point returns to the main form.

in Second Form declarae proc like this:
Public MyProc
'Code to print..
End Sub

In Main form:
Call Form2.MyProc


Regards
Veena

QVeen72
Posting Shark
950 posts since Nov 2006
Reputation Points: 84
Solved Threads: 143
 

Thanks heaps that got me started in the right direction.

lisheen
Newbie Poster
12 posts since Apr 2008
Reputation Points: 10
Solved Threads: 0
 

Another approach, and probably more along the lines of what you're looking for in this case, is to take advantage of Form.Show's Modal argument:

Form3.Show vbModal


This will show the form, with the added effect that all other forms in the application are automatically disabled. This not only prevents the user from doing anything with the application's other forms (Form1 and Form2, in your case) until the modal form (Form3) is hidden ( Form3.Hide ) or unloaded ( Unload Form3 ), but also prevents code in the other forms from running - meaning that your application will pick up execution at the point after the Form.Show call as soon as the form you .Show is closed.

Hope that helps. ^_^

- Sendo Shin

sendoshin
Light Poster
39 posts since Sep 2006
Reputation Points: 16
Solved Threads: 1
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You