ordering controls position in a panel C#
Posted on 2010-01-11
So I have a panel, I want to fill the panel with controls that based on the number of the column in my table. So, I code something like this
foreach (DataColumn col in ds.Tables["myTable"].Columns)
CheckBox newCheckBox = new CheckBox();
TextBox newTextBox = new TextBox();
newCheckBox.ID = "cb" + i;
newCheckBox.Text = col.ToString();
the result will create checkbox & textbox control in panel1, but it disordered (in terms of newline) because the length of each column is different like,
[//textbox2]column numb 3
how can I achieve something like this
column numb 3 [//textbox3]
can I inserting something like tabbing and newline in the line, what to do to expect that view?
or maybe we can create new panel + cb + tb on each iteration, but wont it take a bit long?