Share via


Visual Basic Reference

FontName Property

See Also    Example    Applies To

Returns or sets the font used to display text in a control or in a run-time drawing or printing operation.

Note   The FontName property is included for use with the CommonDialog control and for compatibility with earlier versions of Visual Basic. For additional functionality, use the new Font object properties (not available for the CommonDialog control).

Syntax

object.FontName [= font]

The FontName property syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
font A string expression specifying the font name to use.

Remarks

The default for this property is determined by the system. Fonts available with Visual Basic vary depending on your system configuration, display devices, and printing devices. Font-related properties can be set only to values for which fonts exist.

In general, you should change FontName before setting size and style attributes with the FontSize, FontBold, FontItalic, FontStrikethru, and FontUnderline properties.

Note   At run time, you can get information on fonts available to the system through the FontCount and Fonts properties.