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?
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
Label1.Location=New Point(x,y) is along the lines your looking for, perhaps neal, paszt, or tpm could instruct you further
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
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
 

levyuk

Well-known member
Joined
Jun 7, 2004
Messages
313
Location
Wales, UK
Programming Experience
3-5
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.
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
Indeed you can, but adding a style is a lot easier and gives you more control.
 
Top Bottom