[Solved] Replacing a word in a txt using c# in visual studios


the complete version

private void button1_Click (object sender, EventArgs e)

System.IO.StreamReader sr = new
System.IO.StreamReader(openFileDialog1.FileName);

private void button2_Click (object sender, EventArgs e)

String find textbox1.Text
string replace = "dog";

File.writeAllText(openFileDialog1.FileName,File.ReadAllText(openFileDialog1.FileName).Replace(find, replace));

also need to add a textbox

solved Replacing a word in a txt using c# in visual studios