SaveFileDialog + FileName

  • Thread starter Thread starter gopal
  • Start date Start date
G

gopal

Hi,

I would like to display only the file names in SaveFileDialog control
when i open it the Window in the without the complete file path

Example

if the file - -- test.doc is in folder c:/abc/test.doc

i would like to display ONLY files "test.doc" in FileNames list or all
*.doc files
and offcourse the filetype is *.doc

example

test.doc
test1.doc
test2.doc

Any help..
 
gopal,

Did you try setting the Filter property? You should be able to do this:

fileDialog.Filter = "Word files (*.doc)|*.doc";

Hope this helps.
 
Yes i tried but the problem is in the FileName Combo Box, i see the
files displayed with full path

namely

c:\documents and settings\test.doc
c:\project\test.doc
c:\project\test1.doc

what i need is just the file names be listed without the fullpath

gopal,

Did you try setting the Filter property? You should be able to do this:

fileDialog.Filter = "Word files (*.doc)|*.doc";

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

gopal said:
Hi,

I would like to display only the file names in SaveFileDialog control
when i open it the Window in the without the complete file path

Example

if the file - -- test.doc is in folder c:/abc/test.doc

i would like to display ONLY files "test.doc" in FileNames list or all
*.doc files
and offcourse the filetype is *.doc

example

test.doc
test1.doc
test2.doc

Any help..
 
I'm not quite sure what you mean. Can you show a screen shot showing
what you are talking about?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

gopal said:
Yes i tried but the problem is in the FileName Combo Box, i see the
files displayed with full path

namely

c:\documents and settings\test.doc
c:\project\test.doc
c:\project\test1.doc

what i need is just the file names be listed without the fullpath

gopal,

Did you try setting the Filter property? You should be able to do
this:

fileDialog.Filter = "Word files (*.doc)|*.doc";

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

gopal said:
Hi,

I would like to display only the file names in SaveFileDialog control
when i open it the Window in the without the complete file path

Example

if the file - -- test.doc is in folder c:/abc/test.doc

i would like to display ONLY files "test.doc" in FileNames list or all
*.doc files
and offcourse the filetype is *.doc

example

test.doc
test1.doc
test2.doc

Any help..
 
gopal,

I think this is the way the Windows common dialog works. I doubt it you can
change that.


--
Stoitcho Goutsev (100)

gopal said:
Yes i tried but the problem is in the FileName Combo Box, i see the
files displayed with full path

namely

c:\documents and settings\test.doc
c:\project\test.doc
c:\project\test1.doc

what i need is just the file names be listed without the fullpath

gopal,

Did you try setting the Filter property? You should be able to do
this:

fileDialog.Filter = "Word files (*.doc)|*.doc";

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

gopal said:
Hi,

I would like to display only the file names in SaveFileDialog control
when i open it the Window in the without the complete file path

Example

if the file - -- test.doc is in folder c:/abc/test.doc

i would like to display ONLY files "test.doc" in FileNames list or all
*.doc files
and offcourse the filetype is *.doc

example

test.doc
test1.doc
test2.doc

Any help..
 
Hi,

I am not able to attach the issue as image. the problem goes something
like

In the SaveFileDialog window, below we have two combo boxes

1.FileName - which lists all the files with specified extension given
by us
2.Save as Type - which displays type of file extension namely *.txt

1. FileName combo box - shows the complete path of the files namely

C:\Test1\abc.doc
C:\Test1\abc2.doc

What i want is FileName comboBox should only display file names namely
abc.doc
abc2.doc





I'm not quite sure what you mean. Can you show a screen shot showing
what you are talking about?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

gopal said:
Yes i tried but the problem is in the FileName Combo Box, i see the
files displayed with full path

namely

c:\documents and settings\test.doc
c:\project\test.doc
c:\project\test1.doc

what i need is just the file names be listed without the fullpath

gopal,

Did you try setting the Filter property? You should be able to do
this:

fileDialog.Filter = "Word files (*.doc)|*.doc";

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Hi,

I would like to display only the file names in SaveFileDialog control
when i open it the Window in the without the complete file path

Example

if the file - -- test.doc is in folder c:/abc/test.doc

i would like to display ONLY files "test.doc" in FileNames list or all
*.doc files
and offcourse the filetype is *.doc

example

test.doc
test1.doc
test2.doc

Any help..
 
Hi,

I would like to display only the file names in SaveFileDialog control
when i open it the Window in the without the complete file path

Example

if the file - -- test.doc is in folder c:/abc/test.doc

i would like to display ONLY files "test.doc" in FileNames list or all
*.doc files
and offcourse the filetype is *.doc

example

test.doc
test1.doc
test2.doc

Any help..

If you set the DereferenceLinks Property to false you will not get a list of
files when you open the upper dropdown, but I don't think that was exactly what
you were looking for.

Here is the code:

private void button1_Click(object sender, EventArgs e)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.DereferenceLinks = false;
sfd.ShowDialog();
}
Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 
Otis said:
If you set the DereferenceLinks Property to false you will not get a list of
files when you open the upper dropdown, but I don't think that was exactly what
you were looking for.

Here is the code:

private void button1_Click(object sender, EventArgs e)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.DereferenceLinks = false;
sfd.ShowDialog();
}
Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com



I am not for not showing the list of files, the files shld be
displayed, but only the file names shld be presnt without the full path
of the file

in the File name - drop down/combo box..
 
[snip]
I am not for not showing the list of files, the files shld be
displayed, but only the file names shld be presnt without the full path
of the file

in the File name - drop down/combo box..

Sorry I couldn't help, but there may be another way to do this. You could use
your own dialog box for this made from list boxes and drop downs. You would the
FileInfo object to get the file names from the folder the user is in. However
that would be quite a bit of work.
Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top