Does anyone know how to set the font Italics or bold Properties of the System.Drawing.Font Class?

Here is what I have so far and it works fine but I cannot get the Font Bold or Font Italics to work in the GetSetting Sub?

Thanks for the Help,

TrussworksLeo


#Region "Reg Settings"
Private Sub SaveSettings()

Try
'Place some settings in the registry.
SaveSetting("HBNotePad", "Startup", "Top", "75")
SaveSetting("HBNotePad", "Startup", "Left", "50")

'Font related
SaveSetting("HBNotePad", "Startup", "BackCol", Convert.ToString(textBox1.BackColor.ToArgb()))
SaveSetting("HBNotePad", "Startup", "ForeCol", Convert.ToString(textBox1.ForeColor.ToArgb()))
SaveSetting("HBNotePad", "Startup", "FontName", textBox1.Font.FontFamily.GetName(0))
SaveSetting("HBNotePad", "Startup", "FontSize", Convert.ToString(textBox1.Font.Size))
SaveSetting("HBNotePad", "Startup", "FontBol", Convert.ToBoolean(textBox1.Font.Bold))
SaveSetting("HBNotePad", "Startup", "FontItl", Convert.ToBoolean(textBox1.Font.Italic))

Catch
End Try
End Sub
Private Sub GetSettings()
Try
textBox1.Font = New System.Drawing.Font((GetSetting("HBNotePad", "Startup", "FontName", textBox1.Font.FontFamily.GetName(0))), _
Convert.ToSingle(GetSetting("HBNotePad", "Startup", "FontSize", Convert.ToString(textBox1.Font.Size))))

textBox1.ForeColor = System.Drawing.Color.FromArgb(GetSetting("HBNotePad", "Startup", "ForeCol", Convert.ToString(textBox1.ForeColor.ToArgb())))
textBox1.BackColor = System.Drawing.Color.FromArgb(GetSetting("HBNotePad", "Startup", "BackCol", Convert.ToString(textBox1.BackColor.ToArgb())))

Catch
End Try
End Sub
#End Region

@@@@@@@@@@@@@@@@@@@

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.