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!

Vertical label caption 4

Status
Not open for further replies.

rdavis

Programmer
Apr 29, 2002
157
US
Is there a way to show a caption for a label to be vertical instead of horizontal?

eg.

L instead of Label1
a
b
e
l
1

Thanks


Rob
 
I was just reading through this thread...

(looking for a way to change the orientation of a label...)

...And I noticed this comment...
if you set autosize and wordwrap to true and type with spaces, it doesnt actualy cause a word wrap!!
made by ADoozer

Now there is some truth to that...

And he got close to what my solution is by suggesting Hard-Coding the Labels in the code itself using vbcrlf...

However, I like to be able to change the labels on the Graphical Form Designer...

And there is a way to do this and use spaces with AutoSize and get the results you want without typeing a dozen " & vbcrlf & " between your letters...

Simply set the autosize to true,
Fill in the Caption property with something like "T E S T"

then insert this into the Form_Load sub...
Label1.Caption = Replace(Label1.Caption, " ", vbCrLf)

Now if you are one of those people like me who hate excessive typing ;-)

You can make a sub such as:
Sub VLabel(l as Label)
L.Caption = Replace(L.Caption, " ", vbCrLf)
End Sub


Then simply say...

VLabel Label1
VLabel Label2
VLabel Label3

or you could use the nice feature of being able to create control arrays...

make to Label arrays:
lblHorz() for the horizontal labels
lblVert() for the vertical labels

then you could simply put:
For i = 0 to lblVert.Count - 1
VLabel lblVert(i)
Next




Have Fun, Be Young... Code BASIC
-Josh
cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
CubeE101

I haven't tried it yet but it looks N E A T.

[gray]Experience is something you don't get until just after you need it.[/gray]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top