Results 1 to 6 of 6

Thread: Label problem

  1. #1
    DaoK
    Guest

    Label problem

    Here is the code :
    VB Code:
    1. label1.caption = "This is my number : " & VARIABLE1 & "/" & Variable2

    How can i have only the variable1 in bold ?

  2. #2
    Hyperactive Member
    Join Date
    Dec 2001
    Location
    I'm in front of the computer.
    Posts
    270
    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.
    Alphanos

  3. #3
    DaoK
    Guest
    ... well that so evil way ...

  4. #4
    Hyperactive Member
    Join Date
    Dec 2001
    Location
    I'm in front of the computer.
    Posts
    270
    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.
    Alphanos

  5. #5
    DaoK
    Guest
    I will think to it ...

  6. #6
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    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
    Stuart
    VB Code:
    1. Private Sub Command1_Click()
    2.     Dim Variable1 As Long
    3.     Dim Variable2 As Long
    4.     Variable1 = 200
    5.     Variable2 = 350
    6.    
    7.     'Print to Picture box or form
    8.     With Me
    9.         .CurrentX = 400
    10.         .CurrentY = 400
    11.         .FontBold = False
    12.         Me.Print "This is my number : ";
    13.         .FontBold = True
    14.         Me.Print Variable1;
    15.         .FontBold = False
    16.         Me.Print " / " & Variable2
    17.     End With
    18. End Sub
    19.  
    20. Private Sub Command2_Click()
    21.     'You can work out x,y specifics more exactly for your
    22.     'fake label
    23.     Me.Line (400, 400)-(3200, 800), vbButtonFace, BF 'Erase the label before reprint
    24. End Sub
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width