Here is the code :
VB Code:
label1.caption = "This is my number : " & VARIABLE1 & "/" & Variable2
How can i have only the variable1 in bold ?
Printable View
Here is the code :
VB Code:
label1.caption = "This is my number : " & VARIABLE1 & "/" & Variable2
How can i have only the variable1 in bold ?
You could creat a second label with autosize and bold, fill it with variable one, and zorder it to the front over part of label one. Then instead of
label1.caption = "This is my number : " & VARIABLE1 & "/" & Variable2
say
label1.caption = "This is my number : " & Space(Len(label2.caption) +1) & "/" & Variable2
move label2 to be just right of "number" in label1.
... well that so evil way ...
You could also try:
-finding another control that you could use ie. a rich text box disabled with no border and set to be grey, that might work
-finding a way to get the width of a letter on the screen so that you can programmatically set the spacing better.
I will think to it ...
Hi Daok
Why not just print your 'label' directly to the form
This may appear to be long code but you could set up a sub to handle all of the formatting and just call for each new label that needs diff internal formats.
Regards
StuartVB Code:
Private Sub Command1_Click() Dim Variable1 As Long Dim Variable2 As Long Variable1 = 200 Variable2 = 350 'Print to Picture box or form With Me .CurrentX = 400 .CurrentY = 400 .FontBold = False Me.Print "This is my number : "; .FontBold = True Me.Print Variable1; .FontBold = False Me.Print " / " & Variable2 End With End Sub Private Sub Command2_Click() 'You can work out x,y specifics more exactly for your 'fake label Me.Line (400, 400)-(3200, 800), vbButtonFace, BF 'Erase the label before reprint End Sub