Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

This is the code I entered according to websites I found some info:

 

========================================================

If ((toCheckBold = False) And (toCheckItalic = False)) Then

lblToChange.Font = New Font(lblToChange.Font, FontStyle.Bold)

ElseIf ((toCheckBold = False) And (toCheckItalic = True)) Then

lblToChange.Font = New Font(lblToChange.Font, FontStyle.Bold)

lblToChange.Font = New Font(lblToChange.Font, FontStyle.Italic)

ElseIf ((toCheckBold = True) And (toCheckItalic = False)) Then

lblToChange.Font = New Font(lblToChange.Font, FontStyle.Regular)

ElseIf ((toCheckBold = True) And (toCheckItalic = True)) Then

lblToChange.Font = New Font(lblToChange.Font, FontStyle.Regular)

lblToChange.Font = New Font(lblToChange.Font, FontStyle.Italic)

End If

========================================================

 

The problem is that the new definition for the font rams the old one.

How do I set them to be both Italic and Bold?

 

Thanks

Shahar

Posted

That is because they are now flags, so when you say

 

FontStyle.Italic or FontStyle.Bold

 

you are using the binarmy math on those two, thus turning on both bits.

 

See this for further clarification.

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...