p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Visual Studio 2005 (http://p2p.wrox.com/forumdisplay.php?f=140)
-   -   Center Text within Label (http://p2p.wrox.com/showthread.php?t=37306)

testsubject January 17th, 2006 11:49 AM

Center Text within Label
 
Hi folks,

I know this is going to sound so stupid (really I have tried to look for the answer) how do you center text within a label on a web form in Visual Studio .NET 2005 (VB)??

Thanks


planoie January 17th, 2006 11:59 AM

A webform label control renders a <span> tag with the text inside of it. You can't really center the text side the span tag. However, you could center the span tag on the page using an standard HTML/CSS technique.

-Peter

testsubject January 17th, 2006 12:06 PM

Peter thanks for that, could you give me a little example just so I can get this clear in my head.

Thanks


Bitchass January 12th, 2007 10:26 PM

This should work for you

label1.text = "<center>" & "Centered Text Here" & "</center>"


Pomegranete February 9th, 2007 10:02 AM

label1.text = "hello"
label1.textalign = center

That sould be a lot easier.

Pomegranete

nezar_alakhras October 15th, 2011 12:59 PM

thanks a lot
 
Quote:

Originally Posted by Pomegranete (Post 190081)
label1.text = "hello"
label1.textalign = center

That sould be a lot easier.

Pomegranete



i just registered to say a big thanks to u guy
i didnt know how to find it
but it was a lil bit diff
it was label1.textalign=ContentAlignment.MiddleCenter

but really thanks dear


Nezar Alakhras
Jordan -Amman


All times are GMT -4. The time now is 03:34 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.