Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple forms in project

Status
Not open for further replies.

SprintFlunky

Programmer
Apr 6, 2004
51
US
I have tried every solution I can think of, but I would like the know the "correct" way to handle a simple multiple form / command button processing application. The application displays a "main Menu" that the user selects functions (add record, generate reports, system maintenance, etc..), then a command button opens a sub-form displaying the next set of functions or data entry options.

I can make all that work just fine. The problem I'm having is keeping the different forms in the same "window" with the same properties (size, position, ect). I have tried simple .Show and .ShowDialog form processing and I can make only one form at a time appear, but they bounce all over the screen and changing the size or position of one does not change the others.

I have tried inherited forms and get the same results.

And I have tried MDI. MDI seemed the best solution, but I was having issues making the forms look ok.

If the correct approach is MDI, please let me know so I can continue down that path, otherwise, please let me know how to build an old time simple user interface.

Thanks,

Flunky
 
Either make you forms open centerscreen.

or add the ofrms to your controls collection.

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
After making your form (say form2) in the code of form1 place:
Dim form2 as new form2

Then you'll have access to form2 from form1. Such as being able to use:

form2.show()
form2.hide()

Hope this helps.

~Kc
 
Thnaks for the replies, believe me, this is starting to get frustrating.

Even if I open center screen, the user has the ability to size a window and other than maintaining global variables with postion, size, etc, I have no way of controling the look of the application from screen to screen. I would be VERY interested in learning about the ofrms you mentioned. I can't find a reference to it anywhere.

From what I can tell, VB only allows two ways of displaying screens, each screen a seperate entity in seperate windows, or using the MDI functionality, which is very limiting on the control (Min, Max) controls.

There has got to be a better way. I think I might start looking at ASP, bit I really did not want to go there (yet)

Thanks again,

Chris W.
 
you can add a form to another forms control collection by doing this
it's the same thing as a subform in access

Code:
dim frm2 as new form2
frm2.toplevel = false
me.controls.add(frm2)
frm2.controlbox = false
frm2.show


Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
Now that's to cool - I give it try later today and see if it works like I hope.

Thanks for the help.

Chris
 
Close - and that is a cool feature, but it's still not what I need. The forms will each be different (form1 button loads form2, etc). Each form is it's own class and handled seperatly from the other forms. I just want to override the resize and move events to effect all open forms.

I think I need to create a collection class (of forms) and add/remove forms to it as the application is running. I should be able to override the resize and move events and effect all forms in the collection.

Thats the path I'm heading down right now and starting to get close. I'll post the solution if I make it work.

Thanks for the help.
 
The problem lies in the fact that each form is it's own class so forms controls and events relate only to that instance of the class. If I change size or position of one form, the other forms have no idea that the event fired. Been working with one of the guys at work and I think we have it.

Going to build a form1 with no controls and insert a FormsCollection in that class. Then all other forms will derive from from1. Each form will add itself to the FormCollection and when an event fires, i'll override it and do the same thing for all forms in the collection.

Seems like a lot of work for a simple project, but that is what makes it fun.

Thanks for the input, I'll let you know how it turns out.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top