Link to home
Start Free TrialLog in
Avatar of joyrider
joyrider

asked on

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

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)
Avatar of xmetrix
xmetrix

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
Avatar of joyrider

ASKER

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 :)
   
   
Avatar of Ryan Chong
omg, im tired as hell, spent the past few hours posting in sql and db, lol
ASKER CERTIFIED SOLUTION
Avatar of Jgould
Jgould

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial