From: Claire on
I have Common Dialog loaded on my main form (Form1), which is always
running.
The second form (Form2) is opened ocassionally.
Do I need to load another Common Dialog on Form2 or is it just enough to
make a reference to Common Dialog on Form1?
Is there any advantage (or disadvantage) of one method over another?
Please share your experience,
Claire


From: Nobody on
"Claire" <replyto(a)fra> wrote in message
news:%23ogAtyLnKHA.1548(a)TK2MSFTNGP06.phx.gbl...
>I have Common Dialog loaded on my main form (Form1), which is always
>running.
> The second form (Form2) is opened ocassionally.
> Do I need to load another Common Dialog on Form2 or is it just enough to
> make a reference to Common Dialog on Form1?
> Is there any advantage (or disadvantage) of one method over another?
> Please share your experience,

You can use the control on Form1, however, if Form1 was unloaded, accessing
any property or methods or the controls within it would reload the form. If
you place a second control on Form2, it would take slightly more memory, and
it would slow down loading that form.


From: MikeD on


"Nobody" <nobody(a)nobody.com> wrote in message
news:ebsnrsNnKHA.4392(a)TK2MSFTNGP05.phx.gbl...
> "Claire" <replyto(a)fra> wrote in message
> news:%23ogAtyLnKHA.1548(a)TK2MSFTNGP06.phx.gbl...
>>I have Common Dialog loaded on my main form (Form1), which is always
>>running.
>> The second form (Form2) is opened ocassionally.
>> Do I need to load another Common Dialog on Form2 or is it just enough to
>> make a reference to Common Dialog on Form1?
>> Is there any advantage (or disadvantage) of one method over another?
>> Please share your experience,
>
> You can use the control on Form1, however, if Form1 was unloaded,
> accessing any property or methods or the controls within it would reload
> the form. If you place a second control on Form2, it would take slightly
> more memory, and it would slow down loading that form.
>
>

So what was your recommendation? <g>

I believe the slightly more memory required is very negligible. Perhaps a
few dozen bytes or so if even that much. And since the common dialog doesn't
really do or load anything until you show one of its dialogs, I can't
believe it would slow down loading of the form at all. If it does, it's
probably only milliseconds (at least on a reasonably fast computer). Given
these 2 factors, I'd just go ahead and put another common dialog control on
Form2 for simplicity.

Of course, my *real* recommendation would be to forego the common dialog
control completely and use the Win32 API to display these exact same
dialogs. You can then do things not exposed by the control and you eliminate
having to distribute the OCX.

--
Mike


From: Claire on
Thank you both.
So it is just up to me how to do that.
I am interested in the Mike's suggestion to use API instead of ocx.
Mike, can you show a sample how to do that, please?
Thanks,
Claire

"Claire" <replyto(a)fra> wrote in message
news:%23ogAtyLnKHA.1548(a)TK2MSFTNGP06.phx.gbl...
>I have Common Dialog loaded on my main form (Form1), which is always
>running.
> The second form (Form2) is opened ocassionally.
> Do I need to load another Common Dialog on Form2 or is it just enough to
> make a reference to Common Dialog on Form1?
> Is there any advantage (or disadvantage) of one method over another?
> Please share your experience,
> Claire
>


From: Ralph on
Claire wrote:
> Thank you both.
> So it is just up to me how to do that.
> I am interested in the Mike's suggestion to use API instead of ocx.
> Mike, can you show a sample how to do that, please?
> Thanks,
> Claire
>

Lots of examples on the web here are two ...

"How To Use a Common Dialog File Open Dialog with Win32 API"
http://support.microsoft.com/kb/161286

"Common Dialog API calls"
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=1&txtCodeId=3592

-ralph