Hi, I want to write (insert) some text in existing text file, after some character from the text file. For example, to write text from text box after 50-th character in my text file. I use file stream, stream reader and stream writer.
thanks
Writing (inserting) text affter some character
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Kirtan PatelRank #292 · 8.6K reputationPosted Jun 29, 2009, 2:12 AM EDT
private void button1_Click(object sender, EventArgs e) { int Length = textBox1.Text.Length; string TextData = textBox1.Text; string SubData = TextData.ToString().Substring(50); StreamWriter sw = new StreamWriter("Test.txt"); sw.Write(SubData); sw.Close(); }Dozd59 reputationPosted Jun 29, 2009, 1:27 PM EDT
I think the problem with solution that you suggest is limitation of int type. If we have sting which contain more characters then integer could accept - so we need double - then we can not use substring method (it has integer for argument).
I made solution using lines instant of characters, but the idea was to use characters.
If somebody has idea is good to be post.