Zebra0.com

visual-basic listmanager2

When the user clicks on Font in the menu they can select a font. The font selected will be used for the list box and also for printing.

Add a font dialog controlfontdialog to the project. (It will be named fontDialog1.)

Change the ShowColor property to True.

Add the code shown below:

Private Sub mnuFONT_Click(sender As Object, e As EventArgs) Handles mnuFONT.Click
  On Error Resume Next 'There are some fonts that can't be used in a list box
  FontDialog1.ShowDialog()
  ListBox1.Font = FontDialog1.Font
  ListBox1.ForeColor = FontDialog1.Color
End Sub
Double click on the form and add the code below to the Form Load Event.
 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
   FontDialog1.Font = Me.Font 'Same font as the form
 End Sub   
 

NEXT: Select a Font