Bold Italic and Underlined
In my Wordpad application,I have 3 buttons doing the font functions Bold, Italic and Underlined.
All 3 buttons are Push Buttons.
I have done the following,
If all 3 buttons are clicked:
Richtextbox1.Font=New Font(Combobox1.Text,Combobox2.Text,Font.StyleBold AND Font.StyleItalic AND Font.StyleUnderlined)
But the code doesnt seem to work.
Re: Bold Italic and Underlined
Quote:
Originally Posted by cybertechno
In my Wordpad application,I have 3 buttons doing the font functions Bold, Italic and Underlined.
All 3 buttons are Push Buttons.
I have done the following,
If all 3 buttons are clicked:
Richtextbox1.Font=New Font(Combobox1.Text,Combobox2.Text,Font.StyleBold AND Font.StyleItalic AND Font.StyleUnderlined)
But the code doesnt seem to work.
use OR instead of AND?:)
Re: Bold Italic and Underlined
Hi,
I'm not sure you need to bother with such things. After all, presumably each button will function independently of the others so that you could set Bold or Italic or Underline on their own. An easier way to do it would thus be to have a general "Font flag" to which clicking on Bold adds 1, Italic adds 2 and Underline adds 4 (I think these are the numbers, but you can look them up in the Help), and conversely subtracts if you click off the push button. Then you can always just use the value of "Font Flag" in the [style] part of the argument.
Does that make sense?
HTH
zaza