473,618 Members | 3,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

open/save filedialog woes

i'm trying to make an open and a save file dialog that allows you to open/save
various formats, but when you change the extension you want to filter the file
list disappears [1] until you leave the current directory. here's the code
for the save box:

SaveFileDialog sfd = new SaveFileDialog( );
sfd.Filter = "Portable Document Format (*.pdf)|*.pdf"
+ "|Encapsula ted Postscript (*.eps)|*.eps"
+ "|Bitmap (*.bmp)|*.bmp"
+ "|JPEG (*.jpeg;*.jpg)| *.jpeg;*.jpg"
+ "|GIF (*.gif)|*.gif"
+ "|PNG (*.png)|*.png";

if(sfd.ShowDial og() == DialogResult.OK )
{
// do stuff
}

the open dialog is very similar. anyone know what's going on?

thanks,
pat
[1] - here is an example (the current directory contains 2 files, test1.pdf
and test2.eps).

(Filter = *.pdf), dialog shows test1.pdf
(change filter to *.eps), dialog shows no files
(go up a directory and come back), dialog shows test2.eps
(change filter to *.pdf), dialog shows no files
(go up a directory and come back), dialog shows test1.pdf
Nov 16 '05 #1
2 2639
Pat,

I tried your code. It works fine. Can you give a sample with the case and
mail it to sh***********@y ahoo.com? I will investigate that.

--
Shak
(Houston)
"Pat Richey" <ri****@uiuc.ed u> wrote in message
news:uq******** ******@TK2MSFTN GP09.phx.gbl...
i'm trying to make an open and a save file dialog that allows you to open/save various formats, but when you change the extension you want to filter the file list disappears [1] until you leave the current directory. here's the code for the save box:

SaveFileDialog sfd = new SaveFileDialog( );
sfd.Filter = "Portable Document Format (*.pdf)|*.pdf"
+ "|Encapsula ted Postscript (*.eps)|*.eps"
+ "|Bitmap (*.bmp)|*.bmp"
+ "|JPEG (*.jpeg;*.jpg)| *.jpeg;*.jpg"
+ "|GIF (*.gif)|*.gif"
+ "|PNG (*.png)|*.png";

if(sfd.ShowDial og() == DialogResult.OK )
{
// do stuff
}

the open dialog is very similar. anyone know what's going on?

thanks,
pat
[1] - here is an example (the current directory contains 2 files, test1.pdf and test2.eps).

(Filter = *.pdf), dialog shows test1.pdf
(change filter to *.eps), dialog shows no files
(go up a directory and come back), dialog shows test2.eps
(change filter to *.pdf), dialog shows no files
(go up a directory and come back), dialog shows test1.pdf

Nov 16 '05 #2
Pat Richey wrote:
i'm trying to make an open and a save file dialog that allows you to
open/save various formats, but when you change the extension you want to
filter the file list disappears until you leave the current
directory. here's the code for the save box:


figured it out - somehow the [STAThread] tag got removed from Main() -
replacing it fixed this problem (and several others).
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
3120
by: ulysses | last post by:
Hi, I use PyQt 3.8 non-commercial version in win32. I get a big question. I Can't show PY variable in QT filedialog as initially parameter. Code sample is following: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fileName="test.avi" def saveSomething(aString):
5
21380
by: Phil Stanton | last post by:
Can anyone let me have the code for opening the open file dialog box and getting either a file or folder name as the output. I suspect it will look like Function GetPathOrFile(InputPath as String) As String ...... End function I seem to be able to get one or the other, but not both Files and Folders. I
3
3629
by: sunilrkp | last post by:
javascript code to save the contents of a textarea to a file using FIleDialog.
2
13099
by: akmagnolia | last post by:
Hello- I am trying to use the FileDialog object to allow users to select a file. When I compile, I get the User type not defined error at the first DIM statement. My code is copied right out of the Access help files. Code: --------------------------------------------------------------------------------------- 'Declare a variable as a FileDialog object. Dim fd As FileDialog 'Create a FileDialog object as a File Picker dialog...
16
17796
by: technocraze | last post by:
Hi pals, I would like to know how to display the FileName of the selected file in the textbox and open it using FileDialog property. I have imported the necessary reference from the library - Microsoft Office Object Library 10.0. Tks Control: TextBox - Display FileName Button - Open Code:
3
8387
by: Ecohouse | last post by:
I know how to use the File Dialog control but I'm not sure how to actually open the file that is selected. Here's my code: 'Create a FileDialog object as a File Picker dialog box. Set fd = Application.FileDialog(msoFileDialogOpen) 'msoFileDialogFilePicker ' Select Excel file for import With fd
1
1953
by: Ecohouse | last post by:
I'm trying to use the File Dialog to select an open a file. Here is my code: Set fd = Application.FileDialog(msoFileDialogOpen) With fd If .Show = True Then .AllowMultiSelect = False 'Find the selected file name
13
4962
by: NJonge01 | last post by:
I use this "Access Cookbook" from Ken Getz that comes with some pretty nice sample code and applications. I use some file open features they have but I don't know enough about what they've created to use just the parts I want. I'm trying to use the Windows File Open type dialogue to identify a directory and then return that directory as a string to a function that will ultimately process all the excel spreadsheets in that file and select...
1
1966
by: AccessHunter | last post by:
Hi, I have written a code to display the Save As dialog box for my users, with a default file name. The code works and displays the dialog box with the default name. But when I click the Save button on the dialog box its not actually doing the saving. I am sure some of you might have faced the same issue, please help. Thanks Below is my code. Dim dlgSaveAs As FileDialog
0
8212
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8153
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8653
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8455
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5552
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4065
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2587
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1459
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.