PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 5.00 average.

Add control to Save File Dialog

 
 
Thomas Schoch
Guest
Posts: n/a
 
      29th Aug 2003
I want to add a combobox to the save file dialog, where the user can
choose an additional option.

How can this be done in VB.NET?

Thomas
 
Reply With Quote
 
 
 
 
Tom Spink
Guest
Posts: n/a
 
      30th Aug 2003
Actually, it's not as difficult as you think. The trick is to show the
dialog, grab the window handle and reset it's parent to belong to that of a
form. Then hide the border of the dialog and position it accordingly, then
add your controls underneath. Hey presto custom open file dialog.

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit


"Fergus Cooney" <filter-(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Hi Thomas,
>
> || How can this be done in VB.NET?
>
> Your question has a mistype. It should read "Can this be done in
> VB.NET?" which makes it much simpler to answer. - No :-(
>
> The Save File dialogue is a Windows dialogue and has nothing to do
> with .NET. Any playing around with it (and it can be done) has to be
> done using the Win32 Api.
>
> Adding an extra combo box would be MAJOR work as you'd have to
> increase the size of the window, rearrange all the other controls,
> find a way to populate it, use the user's selection, etc, etc.
>
> The most I've seen other peolpe do is trap mouse clicks on the
> title bar so that they can call their own program but, even then, it's
> specialised programming.
>
> Your best option, if it is that important to you, is to roll up
> your sleeves and create your own dialogue. Someone may have already
> done this (it's highly likely in fact) but I don't know who and a
> quick Google turned up nothing. You might get some joy if you go to
> some of the programmer's web sites.
>
> Good luck,
> Fergus
>
>



 
Reply With Quote
 
Fergus Cooney
Guest
Posts: n/a
 
      30th Aug 2003
Hi Tom,

|| Actually, it's not as difficult as you think.

Hurray, I sit happily corrected. Well done, that man. :-)

|| The trick is to show the dialog, grab the window handle
|| and reset it's parent to belong to that of a form.

Any details,especially the set-parent-from-windows-handle bit?

|| Then hide the border of the dialog and position it accordingly,
|| then add your controls underneath.

So there's no border? Add the controls to the dialogue or ??

Ahah! Is the "a form" mentioned above a new form which is to be a
host container for the dialogue and any extra controls (ie the
combobox)?

Any details about hiding the dialogue's borders (and title bar,
presumably, if it's being hosted)? Sounds like Win stuff to me.

Can you add anything about populating the combo box and doing
something with the selection, too?

Can you forgive me for giving you all these questions? lol.

Regards,
Fergus


 
Reply With Quote
 
Tom Spink
Guest
Posts: n/a
 
      30th Aug 2003
> Any details,especially the set-parent-from-windows-handle bit?

It requires hooking and threads...

> Ahah! Is the "a form" mentioned above a new form which is to be a
> host container for the dialogue and any extra controls (ie the
> combobox)?


It most certainly is.

> Can you add anything about populating the combo box and doing
> something with the selection, too?


When the user has chosen OK on the OFD, just close the form, and return what
you need from the host form.

I've done it once in VB6, maybe I'll try again.

--
HTH,
-- Tom Spink, Über Geek

Please respond to the newsgroup,
so all can benefit


"Fergus Cooney" <filter-(E-Mail Removed)> wrote in message
news:#$(E-Mail Removed)...
> Hi Tom,
>
> || Actually, it's not as difficult as you think.
>
> Hurray, I sit happily corrected. Well done, that man. :-)
>
> || The trick is to show the dialog, grab the window handle
> || and reset it's parent to belong to that of a form.
>
> Any details,especially the set-parent-from-windows-handle bit?
>
> || Then hide the border of the dialog and position it accordingly,
> || then add your controls underneath.
>
> So there's no border? Add the controls to the dialogue or ??
>
> Ahah! Is the "a form" mentioned above a new form which is to be a
> host container for the dialogue and any extra controls (ie the
> combobox)?
>
> Any details about hiding the dialogue's borders (and title bar,
> presumably, if it's being hosted)? Sounds like Win stuff to me.
>
> Can you add anything about populating the combo box and doing
> something with the selection, too?
>
> Can you forgive me for giving you all these questions? lol.
>
> Regards,
> Fergus
>
>



 
Reply With Quote
 
Thomas Schoch
Guest
Posts: n/a
 
      30th Aug 2003
Thanks guys for the discussion on my behalf.

I just thought there would be an easier way to do this in .NET.

Doing some more research on this I found this web page which might
help:
http://www.vbaccelerator.com/home/VB...logs/index.asp

Thanks for your help anyway

Thomas

On Sat, 30 Aug 2003 09:06:37 +0100, "Tom Spink"
<(E-Mail Removed)> wrote:

>> Any details,especially the set-parent-from-windows-handle bit?

>
>It requires hooking and threads...
>
>> Ahah! Is the "a form" mentioned above a new form which is to be a
>> host container for the dialogue and any extra controls (ie the
>> combobox)?

>
>It most certainly is.
>
>> Can you add anything about populating the combo box and doing
>> something with the selection, too?

>
>When the user has chosen OK on the OFD, just close the form, and return what
>you need from the host form.
>
>I've done it once in VB6, maybe I'll try again.


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      30th Aug 2003
Hello,

"Tom Spink" <(E-Mail Removed)> schrieb:
> Actually, it's not as difficult as you think. The trick is to show the
> dialog, grab the window handle and reset it's parent to belong to that of

a
> form. Then hide the border of the dialog and position it accordingly, then
> add your controls underneath. Hey presto custom open file dialog.


Why not use dialog templates?

http://vbaccelerator.com/article.asp?id=1422

I know, it's VB Classic code, but maybe you have enough time to translate it
to VB .NET.

;-)

HTH,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      30th Aug 2003
Hello,

"Tom Spink" <(E-Mail Removed)> schrieb:
> > Any details,especially the set-parent-from-windows-handle bit?

>
> It requires hooking and threads...


You are right. Simple modifications can be done using a dialog hook (VB6
sample):

http://www.mvps.org/vbnet/code/hooks...ookadvtext.htm

HTH,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
File sort order reversed or wrong in File Open or File Save dialog box NinerSevenTango Windows XP General 1 1st Aug 2009 01:48 PM
Invoke 'Save As' Dialog to save WebBrowser control contents Artie Microsoft C# .NET 5 23rd Jan 2008 05:39 PM
Webbrowser control, disable save dialog Henrik Microsoft Access Form Coding 1 5th Apr 2006 10:30 AM
Open\Save Dialog control labels....? SpotNet Microsoft C# .NET 2 6th Nov 2004 02:40 AM
Why have I lost my SAVE AS dialog box to save a file? =?Utf-8?B?QWFyZGJlaQ==?= Microsoft Word Document Management 2 10th Sep 2004 04:13 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:39 PM.