[VB.NET] Problems with RichTextBox.SelectionFont.Style
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
@Squirrels
i dont even lol
dagnabbit -.-
maybe @thomaster or something. Idk.
or @zepdrix I NEEDZ TEH HALP
@Agent47 get in here or I will eat your firstborn child
Jk, figured out the solution. I have to put "Xor" in place of And.
I was just about to say that :3
Suuuuuuuuuuure you were. Anyway, would you like to see the current state of what I'm working on?
Tharr she blows.
Source
Join our real-time social learning platform and learn together with your friends!