S
Sean M
Guest
I can use form1.Controls.Add(myControl) or page.Controls.Add(myControl)
but all of the controls are laid out left to right. I need to insert line breaks so they go top to bottom
instead of label textbox label textbox label textbox
I need
label
textbox
label
textbox
I have tried adding an HTML linebreak to labels but that doesn't do anything. The code i'm working with is posted below:
string[] files = GetCode();
Color labelColor = Color.Red;
Label spacer = new Label();
spacer.Text = "<br />";
for (int i = 0; i < files.Length
{
// currently set to the file name
// create a label for the code
Label label = new Label();
label.ForeColor = labelColor;
label.Text = files;
i++; // move on to the code
// currently set to code for this file
// create a TextBox for this file
TextBox textBox = new TextBox();
textBox.Text = files;
i++; // set up i for the next file
// add the controls to the site
form1.Controls.Add(label);
Page.Controls.Add(spacer);
form1.Controls.Add(spacer);
form1.Controls.Add(textBox);
form1.Controls.Add(spacer);
form1.Controls.Add(spacer);
}
but all of the controls are laid out left to right. I need to insert line breaks so they go top to bottom
instead of label textbox label textbox label textbox
I need
label
textbox
label
textbox
I have tried adding an HTML linebreak to labels but that doesn't do anything. The code i'm working with is posted below:
string[] files = GetCode();
Color labelColor = Color.Red;
Label spacer = new Label();
spacer.Text = "<br />";
for (int i = 0; i < files.Length

{
// currently set to the file name
// create a label for the code
Label label = new Label();
label.ForeColor = labelColor;
label.Text = files;
i++; // move on to the code
// currently set to code for this file
// create a TextBox for this file
TextBox textBox = new TextBox();
textBox.Text = files;
i++; // set up i for the next file
// add the controls to the site
form1.Controls.Add(label);
Page.Controls.Add(spacer);
form1.Controls.Add(spacer);
form1.Controls.Add(textBox);
form1.Controls.Add(spacer);
form1.Controls.Add(spacer);
}