From: MikeD on


"Claire" <replyto(a)fra> wrote in message
news:O0dRXTRnKHA.1548(a)TK2MSFTNGP04.phx.gbl...
> Thank you both.
> So it is just up to me how to do that.

Pretty much. Other than your own personal preference, I don't think it makes
enough of a difference one way or the other to really matter.

> 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?

There are tons of previous posts containing example code. The "downside" is
that each dialog has its own function that you must call. These functions
are:

GetOpenFileName
GetSaveFileName
ChooseColor
ChooseFont
PageSetupDlg
PrintDlg
PrintDlgEx

I'm not sure if the common dialog OCX exposes the PrintDlgEx dialog, which
is actually a Print property sheet. If I remember right, the common dialog
OCX essentially "combines" the older Print dialog and the Page Setup dialog.
You display one or the other of these dialog boxes by assigning a constant
to the control's Flag property and calling the ShowPrinter method
(checking...yep, use the constant cdlPDPrintSetup). Two other common
dialogs not supported by the common dialog OCX are the Find and Find/Replace
dialogs. Those 2 dialog boxes can be shown with the FindText and ReplaceText
API functions. If you search Google Groups on any of these function names,
you should find example VB code.

Try this link:

http://groups.google.com/groups/search?hl=en&as_q=&as_epq=&as_oq=GetOpenFileName+GetSaveFileName&as_eq=&num=100&scoring=&lr=&as_sitesearch=&as_qdr=&as_mind=1&as_minm=1&as_miny=2010&as_maxd=1&as_maxm=1&as_maxy=2010&as_ugroup=microsoft.public.vb.*&as_usubject=&as_uauthors=&safe=off

(might have to combine it into a single line)

If you want to use these functions instead of the control, I *strongly*
recommend that you write them into a class module or standard code module (a
..bas file) that you can simply add to any project. After you've written this
module, make it read-only so you don't accidently change anything that might
cause problems in other projects using the module. Or, make a copy of the
..cls or .bas file (whichever way you choose to write it) for each project
and add that copy to each project instead of the "master" file.


--
Mike


From: mayayana on
> 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?

You might also try here at Randy Birch's site,
assuming that you want FileOpn/FileSave
functionality:

http://vbnet.mvps.org/code/comdlg/fileopendlg.htm

If you just need basic functionality it's fairly simple.
The page linked has a small sample project that can
be copied and pasted.



From: Claire on
Thank you all.
It is nice to learn more.
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: Claire on
I have a small problem when setting dialog choosing Fonts.
I went through several samples posted online but none of them shows how to
do the following:
1.
Show the font sample in the Sample box.
2.
Disable (or hide) Effects frame.
Removing flag CF_EFFECTS from:
FontDialog.flags = CF_SCREENFONTS Or CF_EFFECTS
does not do that.

Please help,
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: Claire on
I solved that.
But I have another question regarding .hdc property.
Do I really need to use it?
I tried the code by Randy Birch at:
http://vbnet.mvps.org/code/comdlg/choosefont2.htm
and I do not see any difference in the result with or without that property
used.
Claire

"Claire" <replyto(a)fra> wrote in message
news:uJILflgnKHA.3636(a)TK2MSFTNGP06.phx.gbl...
>I have a small problem when setting dialog choosing Fonts.
> I went through several samples posted online but none of them shows how to
> do the following:
> 1.
> Show the font sample in the Sample box.
> 2.
> Disable (or hide) Effects frame.
> Removing flag CF_EFFECTS from:
> FontDialog.flags = CF_SCREENFONTS Or CF_EFFECTS
> does not do that.
>
> Please help,
> 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
>>
>
>