[Help] Setting Text Bold And Current StyleFont
I know Tittle Isn't Clear
But What Basicly I want For Example When i set the font italic and then click on bold the text will be only bold not bold and italic i tried this code but didn't work
Code:
RichTextBox1.Font = New Font(RichTextbox1.Font , FontStyle.Bold Or RichTextBox1.Font.Style)
and also i tried to make it if the font is italic it set it bold and italic but it is not the point
i know this code works :
Code:
If Bold = False Then
Bold = True
Dim Style1 = Nothing
Dim Style2 = Nothing
Dim style3 = Nothing
If Italic = True Then
Style1 = FontStyle.Italic
End If
If Underwear = True Then
Style2 = FontStyle.Underline
End If
If Strikeout = True Then
style3 = FontStyle.Strikeout
End If
TextBoxx1.SelectionFont = New Font(TextBoxx1.Font, Style1 Or Style2 Or style3 Or FontStyle.Bold)
Else
Bold = False
Me.TextBoxx1.SelectionFont = New Font(TextBoxx1.Font, FontStyle.Regular)
Dim Style4 = Nothing
Dim style5 = Nothing
Dim Style6 = Nothing
If Italic = True Then
Style4 = FontStyle.Italic
End If
If Underwear = True Then
Style5 = FontStyle.Underline
End If
If Strikeout = True Then
style6 = FontStyle.Strikeout
End If
TextBoxx1.SelectionFont = New Font(TextBoxx1.Font, Style4 Or style5 Or Style6)
End If
Don't use RichTextBox1.Font as the first parameter. That's a font type, not a font name.
RichTextBox1.Font.Name should be used. I.e
[php]
Dim f As New Font(RichTextBox1.Font.Name, 8, FontStyle.Bold Or FontStyle.Underline Or FontStyle.Strikeout Or FontStyle.Italic)
[/php]
I only skimmed the first part of your code, the second was too long and I got bored.
Don't we still have a snippet vault?