How to choose a font using FontDialog in C# and VB.NET

To choose a font using FontDialog in C# and VB.NET you can use the following snippet.

Sample C#

using (var dialog = new FontDialog())
{
	if (dialog.ShowDialog() != DialogResult.Cancel)
	{
		textBox1.Font = dialog.Font;
	}
}

Sample VB.NET

Using dialog = New FontDialog()
	If dialog.ShowDialog() <> DialogResult.Cancel Then
		textBox1.Font = dialog.Font
	End If
End Using

Please Share us:
Please rate this snippet

One thought on “How to choose a font using FontDialog in C# and VB.NET

Leave a Reply