Font Dialog in

We are very familiar with font dialog, we frequently use font dialog in various  text editor like word pad, MS word, Notepad etc. this is very  important for text managing and editing. net framework provides us strong Font Dialog class, through this we can also change the font size, pattern, style etc of text or selected text.

This article shows how to use fontdialog in application. I have already said that The FontDialog box is pretty familiar to anyone who has used a Windows based Word processor. The key point to remember is that its Font property returns a Font object that you assign to a control or form’s Font property.


Example code :

 Suppose you have a Richtextbox named RichTextBox1 on your form,

Along with a button ‘Change Font’.

Private Sub btnFont_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFont.Click

        Dim FontDlg As New FontDialog

        If FontDlg.ShowDialog = Windows.Forms.DialogResult.OK Then

            If RichTextBox1.SelectedText.Trim = “” Then

                RichTextBox1.Font = FontDlg.Font


                RichTextBox1.SelectionFont = FontDlg.Font

            End If

        End If

    End Sub