Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Allignment in Vb.net

Status
Not open for further replies.

keizersoz

Programmer
Apr 22, 2004
67
BE
When I design a WebForm in vb.net and let's say I want to put 10 labels one beneath the other in the middle of the page. But I want all the labels to be exactly on the same distance from the left marge of the WebForm. I'm always arranging the labels manually so that they fit well one beneath the other.

I was wondering isn't there a simpler way of doing this in vb.net?
 
kei: Several ways you might approach this.

1. Use a div tag <div align="center">...</div>
2. Create a table with one cell, set the cell property of the table to align="center"
3. Create a 3 column table, put the lables in the middle column, set the cell alignment to align="left" or "center".

These may be obvious but reliable techniques. You could set the absolute position of each label and make sure the y position is the same for each component. I'm sure there are other ways, just a few for thought.

One other note. The use of html tables for "positioning" objects is quite useful -- if you haven't been applying this technique take a look.

 
Thanks,

I added an Asp.net table, but I don't manage to add text on the table in contrast to a html table.
 
If you created the table from the controls pallete, you need to access the cells with the [][] method. However, I think that what Isadore suggested was that you create the table as a HTML object, not as a ASP component...
 
Sure. A simple html table will do the job quite nicely, just set the border="0" and your good to go.

Thanks Dazz for the insight on the [][] method. I'll have to look into that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top