Results 1 to 3 of 3

Thread: Changing font and style for label

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2005
    Posts
    181

    Changing font and style for label

    How do I change the font of a label and make it to be font?

  2. #2
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: Changing font and style for label

    Quote Originally Posted by JohnRChick
    How do I change the font of a label and make it to be font?
    Hi,

    You go into the properties of your label and change the FontStyle.

    Ore you can do it with code:

    VB Code:
    1. With Label1.Font
    2.           Label1.Font = New Font(.Name, .Size * 1.5, .Style, .Unit)
    3.         End With

    Hope it helps you,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: Changing font and style for label

    Note that the Font constructor is overloaded. If you just want to change the style of the font then use the overload that takes an existing Font as a parameter. For instance, if all you want to do is toggle the Bold style you do this:
    VB Code:
    1. myLabel.Font = New Font(myLabel.Font, myLabel.Font.Style Xor FontStyle.Bold)
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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