Repeat controls

  • Thread starter Thread starter Matthew
  • Start date Start date
M

Matthew

I am wanting to create an order form with a couple of text boxes and a
ComboBox.

Because it's an order form, there need to be several (maybe 5) of them. My
guess is the best way is to create an inherited form, but I couldn't figure
out how to get it to repeat.

Also, when those five controls get filled out, I would like to add another
on the bottom.

Suggestions?

Matthew
 
Matthew said:
I am wanting to create an order form with a couple of text boxes and a
ComboBox.

Because it's an order form, there need to be several (maybe 5) of them. My
guess is the best way is to create an inherited form, but I couldn't figure
out how to get it to repeat.

Also, when those five controls get filled out, I would like to add another
on the bottom.

Suggestions?


Make the group a single User Control?

LFS
 
Make the group a single User Control?

Yes, that's the idea.
However, I still don't know how to make several programmatically.

I am looking for something like this:
For i As Integer = 1 To 4
Me.UserControl1 & i = New UserControl1
Me.Controls.Add(UserControl1 & i)
Next

Unfortunately, that's not valid.

Matthew
 
Matthew said:
Yes, that's the idea.
However, I still don't know how to make several programmatically.

I am looking for something like this:
For i As Integer = 1 To 4
Me.UserControl1 & i = New UserControl1
Me.Controls.Add(UserControl1 & i)
Next


First open up the designer code section and see how VB adds
controls. You'll need to copy that process.

Second you need one variable name to refer to several identical
objects. That means you need to hold them in an array.

Dim MyControls() As UserControl1

LFS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top