How to change font size in lblbox from within?

  • Thread starter Thread starter shelly21
  • Start date Start date
S

shelly21

Guest
I'm having a slight issue trying to figure out how to change the font size within a lbl.box within the program.

The box will display some text depending on which button is pressed. And certain button produces a longer text that would not fit (well) in the label box. So when I try to use lblbox.text.font.size = 8, It doesn't work as that property is ReadOnly.

I could change the font colour easily, but not font size....

Is there another way to do this?

:confused:
 
' EDIT I see your using .NET. Sorry buddy! ;)

It works fine for me! I used:
Code:
Option Explicit

Private Sub Form_Load()

    Label1.Font.Size = 18
    
End Sub
 
Take a look at the Font class constructor. One of the methods is to specify a base font and a new size, so doing something like this:

Code:
Label.Font = New Font(Label.Font, 18)

Ought to do it for you. Something like that anyway.
 
That did it.

Strangely I had the solution in my dream last night.

Not the actual solution but I was dreaming about looking at the init. section to see how the label box was created in the first place.
Scary isn't it? :)
 
Back
Top