Solved

CommonDialog ShowFont help !

Posted on 2003-10-25
5
250 Views
Last Modified: 2013-12-03
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
Comment
Question by:ANGmoh
5 Comments
 
LVL 85

Expert Comment

by:Mike Tomlinson
Comment Utility
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
 

Expert Comment

by:vbaddictor
Comment Utility
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
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 30 total points
Comment Utility
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
 
LVL 1

Author Comment

by:ANGmoh
Comment Utility
hehe ok thanks . another 10 points for ur second answer :P
cheers
0
 

Expert Comment

by:TheMills2003
Comment Utility
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now