changing font style

hi,

i am trying to figure out a way to change 2 attributes for a label's font using code. thus far i have only been able to change one attribute. i want to chenge from bold to bold and underlined, but i can only change it to bold or underlined but never both. im using the following code.

Label1.Font = New Font("Arial", 9.75!, FontStyle.Underline)

i want the label to change to bold and underlined at the same time. help in this regard will be greatly appreciated.

regards,

Mark



Answer this question

changing font style

  • Business Intelligence Analyst

    Hi,

    FontStyle is a Flags enumeration, which means you can combine its values by using the Or operator:

    Label1.Font = New Font("Arial", 9.75!, FontStyle.Underline Or FontStyle.Bold)

    Also, if you're just changing font's style, you can use the existing font, like:

    Label1.Font = New Font(Label1.Font, FontStyle.Underline Or FontStyle.Bold)

    Andrej



  • Xancholy

    thanx
  • changing font style