hlominac
asked on
Display comboxes created at runtime
I am generating comboboxes as:
Public Combos() As ComboBox
later I use:
ReDim Combos(5)
For J = 0 To 5
Combos(J) = New ComboBox
Next
I use Combos(0).Items.Add(Item) for example to populate them.
However I cannot display the comboboxes on the form.
What is missing?
Public Combos() As ComboBox
later I use:
ReDim Combos(5)
For J = 0 To 5
Combos(J) = New ComboBox
Next
I use Combos(0).Items.Add(Item) for example to populate them.
However I cannot display the comboboxes on the form.
What is missing?
This Article may help you in creating dynamic combobox in windows form:-
http://aspalliance.com/138 5_Building _Dynamic_N ET_Control s_with_Win dows_Forms .2
http://aspalliance.com/138
ASKER
Dhaest:,
When I ran your code I got an error message at: Me.Controls.Add(x)
Controls is not a member of MyProgram.Data where Data is the subroutine containing the code.
How do I declare Controls?
Harold
When I ran your code I got an error message at: Me.Controls.Add(x)
Controls is not a member of MyProgram.Data where Data is the subroutine containing the code.
How do I declare Controls?
Harold
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Using your example I learned a lot about creating in runtime. Thank you!
Example:
For J = 0 To 5
ComboBox x = New ComboBox
x.Size = New System.Drawing.Size(60, 15)
x.Location = New System.Drawing.Point(30 * J, 200)
Me.Controls.Add(x)
Combos(J) = x
Next
http://www.dreamincode.net/forums/topic/63445-dynamic-form-and-controls-generation/