I have a form with a textbox and I want that textbox to read from text file ,manipulate information in text file and write it to another text file. read each line and when see -- into line break and continue next line until to file end.this code have problem can you help me???
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = openFileDialog1.FileName.ToString();
string[] fileA = System.IO.File.ReadAllLines(@"textBox1.Text"); error it this line why???
string[] fileB={};
int count=0;
foreach (string line in fileA)
{
string str = line;
for (int i = 0; i < str.Length; i++)
{
if (str[i] == '-')
{
if (str[i + 1] == '-')
break;
}
else
{
continue;
}
count++;
}
for (int j = 0; j < count; j++)
{
fileB[j] = str[j].ToString();
}
System.IO.StreamWriter file =
new System.IO.StreamWriter("c:\result.txt", true);
}
}