shahare Posted October 4, 2008 Posted October 4, 2008 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 Quote
Leaders snarfblam Posted October 6, 2008 Leaders Posted October 6, 2008 lblToChange.Font = [color="Blue"]New [/color]Font(lblToChange.Font, [i]FontStyle.Italic [color="Blue"]Or [/color]FontStyle.Bold[/i]) Quote [sIGPIC]e[/sIGPIC]
Nate Bross Posted October 7, 2008 Posted October 7, 2008 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. Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.