How to use common dialog without placing the ocx control on the form

joyrider
joyrider used Ask the Experts™
on
Hi,

i made this small function that will set the backcolor of a picturebox to the color selected in the color selector dialog of common dialogs. Now i used the common dialog control and have set it on my form, but i need to use this function in multiple forms, and i can't seem to find out how i can use commondialog without using the component , i mean without putting it on the form and using that one. So how can i do this ? (referencing)
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
is the control on a form thats always available/loaded ? If so simply call to it.

for example, if your using an mdi setup, you'd put the CommonDialog control on the mdi form so that it'd be

MDIForm1.CommonDialog1


then you'd just use it like from form1

pubic sub form1_load()
   MDIForm1.CommonDialog1.showcolor
   me.backcolor=MDIForm1.CommonDialog1.color
end sub

Author

Commented:
that's not what i was looking for, u would still have to use the control, but i found it myself

it's :
dim cmdialog as object
Set cmDialog = CreateObject("MSComDlg.CommonDialog")

that's what i was looking for :)
   
   

Commented:
omg, im tired as hell, spent the past few hours posting in sql and db, lol
Commented:
question will be moved to PAQ and points refunded in 72 hours, if no other comment regarding closure is made

as per request here
http://www.experts-exchange.com/Community_Support/CleanUp/Q_20417453.html

Jgould-EE Moderator

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial