 |
 |

11-25-2002, 07:00 AM
|
|
|
Help with program flow
|
Ok, This may be cause I have learned VB coding by doing VBA, or it may just be an oversight on my part, or maybe I just need to learn to deal with this. But on with the question. I am working in VB 6 now.
I have a form with buttons on it that allow users to click to open new forms, and work in the new forms. My problem is, I don't want to unload the old form, and I want the program to stop where it is when I open the new form, and not move on until I close the form.
I have written the program under the buttonclick on the first form, and I want it to open a form, and then wait til the form is closed to do stuff to the data, and then open another form, and wait, and do stuff, etc...etc...
Is there a way to do this or do I just need to attach each proceeding form to the exit click on the previous form.
Thanks for help in advance.
|
|

11-25-2002, 07:03 AM
|
 |
Junior Contributor
|
|
Join Date: Nov 2000
Location: England
Posts: 271
|
|
I'm guessing you would want to hide the first form, start the second form and then unhide the original form when the second form is visible.
I would do this
Code:
Form1.visible = false
Form2.show vbmodal'execution paused here until form2 is closed
Form1.visible = true
|
__________________
"It's absurd and I don't take part in absurdities......."
|

11-25-2002, 07:20 AM
|
|
|
|
Thank you very much. That solved my current problem.
Is it better to have one main program that runs through all, or would it be more productive to have each form open the next on a buttonclick?
|
|

11-25-2002, 07:27 AM
|
 |
Junior Contributor
|
|
Join Date: Nov 2000
Location: England
Posts: 271
|
|
|
Depends on your memory requirements I would have thought. Opened all the forms in one go would be a drag on resources. I generally open a form as and when I need it.
|
__________________
"It's absurd and I don't take part in absurdities......."
|

11-25-2002, 07:31 AM
|
|
|
Oops, I meant would it be better to have a main module that opens each form as vbmodal, and then after they are closed opens the next form.
I think I will be doing it in one main module. I think I can loop through and use the same for about 10 times just by dynamically enabling optionbuttons.
Thanks for the help.
|
|

11-25-2002, 07:46 AM
|
 |
Regular
|
|
Join Date: Nov 2002
Location: ITALY
Posts: 93
|
|
|
In my opinion you should decide not depending on the memory occupation (that's not so expansive just for some forms opened) but depending on the easiest and cleanest way to write code.
Anyway I suggest you to have a main funciton in wich you have several "show vbmodal" calls
In each form the "next" button should not close but just use the
hide method
Private sub NextButton_Click()
me.hide
end sub
And in the main function
Form1.show vbModal
Form1.get.... various information and doing stuff
Unload Form1
Form2.show vbModal
Form2.get.... various information and doing stuff
Unload Form2
|
|

11-25-2002, 08:44 AM
|
|
|
|
Ok, kewl. That is the way I'm doing it. I just wanted someone to tell me I was doing it the best way. I figured it would be better to keep it together, but Didn't know if it would, since I haven't did a lot of object oriented coding yet. This is my first big project with VB, and it will prolly take a couple weeks to complete.
Thanks much.
|
|

11-25-2002, 09:45 AM
|
 |
Regular
|
|
Join Date: Nov 2002
Location: ITALY
Posts: 93
|
|
|
there's not always a "best" way.
Just try to make your program reedable and mantainable and logic in the structure.
Anyway 2 weeks is not so big... at least for my standards
|
|

11-25-2002, 11:38 AM
|
|
|
well considering I haven't did much coding in a year or so, and all my college work took me no time to do, this is a big project. 
|
|

11-26-2002, 06:55 AM
|
 |
Regular
|
|
Join Date: Nov 2002
Location: ITALY
Posts: 93
|
|
|
So good luck and contact if you need help
|
|

11-26-2002, 02:47 PM
|
|
|
|
Thanks very much. I love having this place to get help.
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|