Solved

CommonDialog ShowFont help !

Posted on 2003-10-25
5
259 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
ID: 9619730
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
ID: 9619908
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
ID: 9619931
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
ID: 9620039
hehe ok thanks . another 10 points for ur second answer :P
cheers
0
 

Expert Comment

by:TheMills2003
ID: 9620725
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB 6.0 printer how to align 6 62
How to make an ADE file by code? 11 83
Protecting vb6 & .Net code Obfuscation 18 121
RUNRMTCMD from AS/400 12 44
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

776 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