Ask your own question, for FREE!
Computer Science 8 Online
OpenStudy (poopsiedoodle):

[VB.NET] Problems with RichTextBox.SelectionFont.Style

OpenStudy (poopsiedoodle):

My Code: `Private Sub ToolStripButton4_Click(Sender as Object, e as eventargs) Handles ToolStripButton4.Click` ` If RichTextBox1.SelectionFont.Style = FontStyle.Regular Then` ` RichTextBox1.SelectionFont = New Font(RichTextBox1.Font.Name, RichTextBox1.Font.Size, FontStyle.Bold) ` ` Else` ` RichTextBox1.SelectionFont = New Font(RichTextBox1.Font.Name, RichTextBox1.Font.Size, RichTextBox1.SelectionFont.Style and FontStyle.Bold)` ` End if` ` End Sub` ` Private Sub ToolStripButton5_Click(Sender as Object, e as eventargs) Handles ToolStripButton5.Click` ` If RichTextBox1.SelectionFont.Style = FontStyle.Regular Then` ` RichTextBox1.SelectionFont = New Font(RichTextBox1.Font.Name, RichTextBox1.Font.Size, FontStyle.Italic)` ` Else` ` RichTextBox1.SelectionFont = New Font(RichTextBox1.Font.Name, RichTextBox1.Font.Size, RichTextBox1.SelectionFont.Style and FontStyle.Italic)` ` End If` ` End Sub` What it's supposed to do: Support multiple fontstyles (bold, italic, etc.) at once. What I've Tried: I have tried using this code, and pressing the bold button while selecting text. It worked fine. However, when I clicked the Italic button, it changed it back to FontStyle.Regular instead of Bold and Italic. What do I do to fix it? @wio @bibby @Opcode

OpenStudy (poopsiedoodle):

@Squirrels

OpenStudy (squirrels):

i dont even lol

OpenStudy (poopsiedoodle):

dagnabbit -.-

OpenStudy (poopsiedoodle):

maybe @thomaster or something. Idk.

OpenStudy (poopsiedoodle):

or @zepdrix I NEEDZ TEH HALP

OpenStudy (poopsiedoodle):

@Agent47 get in here or I will eat your firstborn child

OpenStudy (poopsiedoodle):

Jk, figured out the solution. I have to put "Xor" in place of And.

thomaster (thomaster):

I was just about to say that :3

OpenStudy (poopsiedoodle):

Suuuuuuuuuuure you were. Anyway, would you like to see the current state of what I'm working on?

OpenStudy (poopsiedoodle):

Tharr she blows.

OpenStudy (poopsiedoodle):

Source

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!