Add New Line Programmatically?

mpdillon

Member
Joined
Feb 17, 2005
Messages
20
Location
Glen Mills, PA
Programming Experience
Beginner
I would like to know how to add a blank space and a new line programatically in the code behind file. For example, the code below adds two labels. When the page is displayed they are on the same line, one touching the other.

Dim Label1 As New Label
Dim Label2 As New Label
Label1.Text = "Label 1"
Label2.Text = "Label 2"
Me.Controls.Add(Label1)
Me.Controls.Add(Label2)

How do I add some spaces on the form between the controls and how do I add a line return?
Thanks

Bonus question - Is there any way to prevent the text in a Checked list from wraping?
 
Label1.Location=New Point(x,y) is along the lines your looking for, perhaps neal, paszt, or tpm could instruct you further
 
hmm yes it's not as straight forward as windows forms. I belive the way to do it is to add the styles left, position and top. eg: label1.style.add("MyStyle", "LEFT: 50px; POSITION; absolute;TOP: 50px")

Hope that helps

TPM
 
I thought you could use the response.write function to insert some html code at runtime but I'm not sure if this is possible.
 
Indeed you can, but adding a style is a lot easier and gives you more control.
 
Back
Top