IzzyTwinkly
asked on
read from a richtextbox and write to the text file
Hi,
I am trying to read line by line from a richtextbox and write it to the text file.
but the contents on the text files are like
System.String[]
System.String[]
System.String[]
System.String[]
System.String[]
...
What is going on here? How should I fix this issue?
My codes are follow:
string myPath = @"C:\\MyFolder" + "myTextFile.txt";
StreamWriter sw = File.CreateText(myPath);
int count = myRichTbx.Lines.Length;
for (int i = 0; i < count; i++)
{
sw.WriteLine(myRichTbx.Lin es.ToStrin g());
}
sw.Close();
I am trying to read line by line from a richtextbox and write it to the text file.
but the contents on the text files are like
System.String[]
System.String[]
System.String[]
System.String[]
System.String[]
...
What is going on here? How should I fix this issue?
My codes are follow:
string myPath = @"C:\\MyFolder" + "myTextFile.txt";
StreamWriter sw = File.CreateText(myPath);
int count = myRichTbx.Lines.Length;
for (int i = 0; i < count; i++)
{
sw.WriteLine(myRichTbx.Lin
}
sw.Close();
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window