Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Help with program flow


Reply
 
Thread Tools Display Modes
  #1  
Old 11-25-2002, 07:00 AM
rkane
Guest
 
Posts: n/a
Exclamation 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.
Reply With Quote
  #2  
Old 11-25-2002, 07:03 AM
fredriko's Avatar
fredriko fredriko is offline
Junior Contributor
 
Join Date: Nov 2000
Location: England
Posts: 271
Default

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......."
Reply With Quote
  #3  
Old 11-25-2002, 07:20 AM
rkane
Guest
 
Posts: n/a
Default

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?
Reply With Quote
  #4  
Old 11-25-2002, 07:27 AM
fredriko's Avatar
fredriko fredriko is offline
Junior Contributor
 
Join Date: Nov 2000
Location: England
Posts: 271
Default

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......."
Reply With Quote
  #5  
Old 11-25-2002, 07:31 AM
rkane
Guest
 
Posts: n/a
Default

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.
Reply With Quote
  #6  
Old 11-25-2002, 07:46 AM
JaneCharro's Avatar
JaneCharro JaneCharro is offline
Regular
 
Join Date: Nov 2002
Location: ITALY
Posts: 93
Default

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
Reply With Quote
  #7  
Old 11-25-2002, 08:44 AM
rkane
Guest
 
Posts: n/a
Default

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.
Reply With Quote
  #8  
Old 11-25-2002, 09:45 AM
JaneCharro's Avatar
JaneCharro JaneCharro is offline
Regular
 
Join Date: Nov 2002
Location: ITALY
Posts: 93
Default

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
Reply With Quote
  #9  
Old 11-25-2002, 11:38 AM
rkane
Guest
 
Posts: n/a
Default

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.
Reply With Quote
  #10  
Old 11-26-2002, 06:55 AM
JaneCharro's Avatar
JaneCharro JaneCharro is offline
Regular
 
Join Date: Nov 2002
Location: ITALY
Posts: 93
Default

So good luck and contact if you need help
Reply With Quote
  #11  
Old 11-26-2002, 02:47 PM
rkane
Guest
 
Posts: n/a
Default

Thanks very much. I love having this place to get help.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->