|
-
Oct 4th, 2007, 08:34 AM
#1
Thread Starter
Lively Member
[2005] Help with using TableLayoutPanel and dynamic Combobox
Ok, I need some serious help with this. I've searched on the forums, googled, and expermimented as much as I can....all to no avail.
Here's the problem.
I'm using a TableLayoutPanel to dynamically configure a form based on values from a database. To the TableLayoutPanel, I dynamically add 1 Label, 1 Textbox, 1 Button, and 1 Combobox. Here's the root of the problem, If I have 2 or more rows in the TableLayoutPanel, ALL the Comboboxes change at the same time.
What do I have to do to only get 1 Combobox to change at a time??
Here's the code I'm using
Code:
If lobjDS.Tables(0).Rows.Count > 0 Then
Me.TableLayoutPanel1.SuspendLayout()
For Each dr As DataRow In lobjDS.Tables(0).Rows
llbl = New Label
With llbl
.Text = dr("Description") & ":"
.Margin = New Padding(2, 2, 2, 2)
.TextAlign = ContentAlignment.MiddleRight
.Dock = DockStyle.Fill
.AutoSize = True
End With
lCombobox = New ComboBox
With lCombobox
.Dock = DockStyle.Fill
.DisplayMember = "Description"
.ValueMember = "Value"
.DataSource = VDPOperators
End With
lTextbox = New TextBox
With lTextbox
.Dock = DockStyle.Fill
End With
lButton = New Button
With lButton
.Text = "AND"
.Height = 22
.Width = 38
End With
With Me.TableLayoutPanel1
.Controls.Add(llbl)
.Controls.Add(lCombobox)
.Controls.Add(lTextbox)
.Controls.Add(lButton)
End With
Next
Me.TableLayoutPanel1.ResumeLayout()
Thanks for any suggestions!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|