BrianBeck
asked on
Getting dlgCommonDialog to work
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
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
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)
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)
ASKER
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.
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.
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.
press function key F4
you will get one properties window. in that window the first property (name) there you set the name.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Private const cdlPDPrintSetup = &H40
Also maybe add this
Also maybe add this
Open the properties page window. Click on the common dialog control
In the properties page window doubl click Name , Change the Commondialog1 to dlgConnonDialog
In the properties page window doubl click Name , Change the Commondialog1 to dlgConnonDialog
Add the common dialog control to your form and rename dlgCommonDialog