• 0

C# Webpage Textbox help!


Question

First, thanks to those that helped me last time a week or 2 ago.
 

 

Remember, I am really a beginning in C#, so I don't know a lot as you guys do, but I am learning to work on that.


Here is what I need help with this time:
 

Say there is a Text Box to input a string -> [Textbox] id:textbox (It will just be a string, won't change to int or anything.) This is on a file on root directory

 

Say I made a folder called Folder1, inside this folder I created a class file - example.cs

 

 

I want to store whatever people input from textbox of the page from root directory into this example.cs file in Folder1 - read/write call it a property TextValue and return it

 

 

Say I made another folder called Folder2, inside this folder, a page, class I make example2.cs that will read the TextValue and displays it.

Can someone help me with the codes or refer me to a good tutorial on how to do this?

Thanks!



 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Your post makes no sense to be honest.

 

But if you mean you want to read and write values to a text file in a folder from a  textbox control..you should read up on..

 

Stream Reader class

 

http://msdn.microsoft.com/en-us/library/system.io.streamreader(v=vs.110).aspx

 

Stream Writer class

 

http://msdn.microsoft.com/en-us/library/system.io.streamwriter(v=vs.110).aspx

Link to comment
Share on other sites

  • 0

Do you mean the root folder of the hard drive? That's protected and requires admin elevation. If this is a web site why not store it in the site's directory structure?

 

You can just use System.IO.File.WriteAllText() to save the TextBox contents.

Link to comment
Share on other sites

This topic is now closed to further replies.