Click here to Skip to main content
15,921,716 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai,

I have one TextBox and Button.

If i enter Some text in that TextBox and then i click the Button.

That text are Save in the New Notepad.

Thanks in Advance.
Posted
Updated 21-Nov-11 23:20pm
v3

This[^] would help you out.
 
Share this answer
 
If you mean to save the text in a Notepad file (i.e. a text file, or one that has the extension ".txt") then it is pretty simple:

Handle the Button Click event, and insert the following code:
C#
File.WriteAllText(@"C:\Temp\MyFile.txt", myButton.Text);
You don't need to use a stream for something that simple!
 
Share this answer
 
Comments
Sam Path 22-Nov-11 4:25am    
Thank you sir.
Write this code at button click event.


C#
StreamWriter s=new StreamWriter(Application.StartupPath+"my.txt");
            s.Write(textBox1.Text);
            s.Close();


You should have to include System.IO namespace to access the IO operaions.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900