Computer Science Canada

Drop Down Menu/New Forms

Author:  mashyouup [ Wed May 24, 2006 8:44 am ]
Post subject:  Drop Down Menu/New Forms

Hey guys, I am working on a program that allows a user to manage a 'restaurant'. My interface consists of a drop down menu. I made it so that as default the user has an empty drop down box and they click on a command key to add tables to the list. This is my code for adding tables:

Quote:
intCounts = intCounts + 1
cmbTable.AddItem "Table " & intCounts


Thus everytime the button is clicked the dropdown menu has a new Table(ie Table1, Table2, Table3 etc.). I also included remove a table and clear tables command buttons.

The section that I need help with is an individual order form for each table. The code that I was using is:

Quote:
If cmbTable.Text = "Table 1" Then
Load frmOrder
frmOrder.Show


The issue I have with this is that I need a different order form for each different table. This is an issue because the user can add as many tables as they need. I was wondering if there was an easier way to do this other than making a whole bunch of forms and using

If cmbTable.Text = "Table 1" Then
Load frmTable1
If cmbTable.Text = "Table 2" Then
Load frmTable2 .... etc.

Thanks!

Author:  cool dude [ Wed May 24, 2006 3:12 pm ]
Post subject: 

firstly wat's different with the order forms for each new table? couldn't u just clear the last order and reuse the same form. as well if its a minor not too big change u can just use the visibility property and make the objects that u don't need invisible so they won't be seen. if u really want u can just make frames, which is the best way instead of having a lot of forms.

Author:  Brightguy [ Wed May 24, 2006 3:31 pm ]
Post subject:  Re: Drop Down Menu/New Forms

Yes, you can create objects at run time. For example:
VisualBASIC:
Dim newTable As frmOrder
Set newTable = New frmOrder


: