Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Getting dlgCommonDialog to work

Posted on 2004-04-02
7
1,445 Views
Last Modified: 2012-08-14
Hi Experts

I've added a CommonDialog control to my Form1, and in that form's code I've included:

Private Sub mnuFile_PageSetup_Click()
   With dlgCommonDialog
        .CancelError = True
        .DialogTitle = "Page Setup"
        .Flags = cdlPDPrintSetup
        .ShowPrinter
    End With
End Sub

I run the app and VB stops at the dlgCommonDialog line and brings up a "variable not defined" message.
Why is this and how do I fix it?

Thanks in advance
Brian
0
Comment
Question by:BrianBeck
7 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 10740161
Select Microsoft common dialog control 6.0 from Projects->components

Add the common dialog control to your form and rename dlgCommonDialog
0
 
LVL 39

Expert Comment

by:appari
ID: 10740172
did you set the name of the commonDialog to "dlgCommonDialog"? check it.

if it is named properly then is the menu is in the same form?( what i guess is may be menu is on MDI form and commondialog on mdi child. if this is the case add form name before dlgCommonDialog somthing like form1.dlgCommonDialog)
0
 

Author Comment

by:BrianBeck
ID: 10740191
Thanks EDDYKT,

Yes I've done step 1 and added the control to my form.
But how do I rename the control??  If I right-click the control, I can call up its Property page, but there doesnt seem to be a Rename function...

I'm sure there's a simple answer...much appreciated.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 39

Expert Comment

by:appari
ID: 10740302
select the control.

press function key F4

you will get one properties window. in that window the first property (name) there you set the name.
0
 
LVL 48

Accepted Solution

by:
Mikal613 earned 125 total points
ID: 10740303
Forget changing it just do thid

Private Sub mnuFile_PageSetup_Click()
   With CommonDialog1
        .CancelError = True
        .DialogTitle = "Page Setup"
        .Flags = cdlPDPrintSetup
        .ShowPrinter
    End With
End Sub

CommonDialog1 is the default name
0
 
LVL 48

Expert Comment

by:Mikal613
ID: 10740320
Private const cdlPDPrintSetup = &H40

Also maybe add this
0
 
LVL 5

Expert Comment

by:Pi7
ID: 10740340
Open the properties page window. Click on the common dialog control
In the properties page window doubl click Name , Change the Commondialog1 to dlgConnonDialog
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

792 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