Installed Font Name List Using Array

Description: Returns an array of installed font names as strings which could be used in things like drop down combo boxes for seeing and selecting fonts currently installed.
Tested Platform: .NET 4.5, Visual Studio 2012, Windows 7
Language: VB.NET
'List installed font family names using for loop and return array.

Public Function listInstalledFonts() As String()

        Dim InstalledFonts As New System.Drawing.Text.InstalledFontCollection()

        Dim families() As FontFamily = InstalledFonts.Families

        Dim fontNames(families.Length - 1) As String

        For i = 0 To families.Length - 1
            fontNames(i) = families(i).Name

        Return fontNames

End Function

Submitted: April 25, 2013

Return to the snippets listing