can someone help.. i can see the file when i click the save button on my folder.. can you help me...

{
            SaveFileDialog dialog = new SaveFileDialog();
            saveFileDialog1.ShowDialog();
            saveFileDialog1.InitialDirectory = @"C:\sample";
           
            saveFileDialog1.Title = "Browse a file";
            saveFileDialog1.DefaultExt = "txt";
            saveFileDialog1.Filter = "Text Files (*.txt)|*.txt| PDF File (*.pdf)|*.pdf";
            saveFileDialog1.FilterIndex = 2;
            saveFileDialog1.RestoreDirectory = true;
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {

                textBox1.Text = saveFileDialog1.FileName;
               
            }
            
        }

Recommended Answers

All 4 Replies

all i want is to save a file on my folder with an extension of pdf and txt...

there is no operation in your code to save a file to a folder.

string str = saveFileDialog1.FullName;
str will have the complete path of your selected file, you will have to use File.Copy() to copy the file to your destination folder.

@arunkumars, thank you for your help. now it clears to my minds my problem.. once again thank you.. Happy Coding

@cyberdaemon :
you are welcome, could you please add a reputaion point to the thread.
also mark the thread as solved.

Happy coding.. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.