954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to view file path in textbox after saving....

I created a browse button and it will allow the user to either open or save a file to their directory, but the problem I am having is how to be able to view the path location in a textbox so the user can see where they saved it...

here is what I have so far:

string FilePath = "C:/Users/oZ012D/My Documents/ExporterOutput.txt";
            if (!File.Exists(FilePath))
            {
                using (StreamWriter sw = File.CreateText(FilePath))
                {
                    sw.WriteLine("Hello");
                    sw.WriteLine("And");
                    sw.WriteLine("Welcome");
                }
                Response.Write("Success!");
            }
            using (StreamReader sr = File.OpenText(FilePath))
            {
                string s = "";
                while ((s = sr.ReadLine()) != null)
                {
                    Console.WriteLine(s);
                }
            }


This looks like it should work but it doesn't...if someone could send me in the right direction or fix my code that would be great!

Thank you!

sastokes
Junior Poster in Training
50 posts since Oct 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: