tags:

views:

25

answers:

3

hi im working on an window application form in which i have to save the data in text file which should contains the data the user would write in the richtextbox in that form......

A: 

This could be of some help.

Simple Text File Operations in C#. and how to use Open and Save As Dialog Boxes

Shoban
A: 

you have one of 2 choices...

  1. create a file stream that simply writes the text out to a file:
  2. serialize the contents (more work)

Check MSDN here for simple file stream

    FileStream fs=new FileStream("c:\\Variables.txt", FileMode.Append, FileAccess.Write, FileShare.Write);
    fs.Close();
    StreamWriter sw=new StreamWriter("c:\\Variables.txt", true, Encoding.ASCII);
    string NextLine="This is the appended line.";
    sw.Write(NextLine);
    sw.Close();
dboarman
A: 
    Dim op As New OpenFileDialog
    op.ShowDialog()
    If op.FileName <> "" Then
        My.Computer.FileSystem.WriteAllText(op.FileName, TextBox1.Text)
    End If
Microgen