Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 295
  • Last Modified:

CommonDialog ShowFont help !

Commondialog.ShowFont , it gives me an error
 "There are no fonts installed . Open the Fonts folder in control panel to install fonts " .

I went to control panel - Fonts and i found there's many fonts inside .

What's the matter with it ? how to fix it ?  i'm using Common Dialog 6 .
0
ANGmoh
Asked:
ANGmoh
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
From the VB Help file:

Before you use the ShowFont method, you must set the Flags property of the CommonDialog control to one of three constants or values: cdlCFBoth or &H3, cdlCFPrinterFonts or &H2, or cdlCFScreenFonts or &H1.  If you don't set Flags, a message box is displayed advising you that "There are no fonts installed," and a run-time error occurs.

So use one of these three lines of code:

CommonDialog1.flags = cdlCFBoth
CommonDialog1.flags = cdlCFPrinterFonts
CommonDialog1.flags = cdlCFScreenFonts

Before attempting to show the font dialog with:
CommonDialog1.ShowFont

Hope this helps!
0
 
vbaddictorCommented:
oh ok thanks .

i have anohter question , and i'll increase the points to 50 if u can answer it too .. hehe .. too lazy to create another new question :P

by the way , can i show the color and font style selection box at the same time ?

ie . integrated common.showcolor and common.showfont at 1 time .
0
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
Sorry, I know of no way to accomplish that using the Common Dialog Controls.  The dialog windows are displayed modally, meaning code execution stops until they are closed.

You would have to create your own custom Font/Color chooser form and manage ALL the gritty details of enumerating the fonts and generating colors yourself.
0
 
ANGmohAuthor Commented:
hehe ok thanks . another 10 points for ur second answer :P
cheers
0
 
TheMills2003Commented:
Hi there,

The answer to this error is simple. You have to VB which flags your using in the Show Font.

This Snippet of code will make your Show Font work:

cdlCommon.Flags = cdlCFBoth
cdlCommon.ShowFont

Hope This Help.
Gary Mills
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now