Q:

Confusion about Find And Replace

Hi I am trying to find and replace  string. The problem is that String. Replace function needs two parametres for oldvalue and new value .I need something like that 
 (content, textBox1.Text, textBox1.Text)

I have tried using Regex but It didnt work
   private void button1_Click(object sender, EventArgs e)
        {

        openFileDialog1.Filter = "All Files|*.*|Images Files(*.jpeg)|*.jpeg";
        //openFileDialog1.Multiselect = true;

        DialogResult dr = openFileDialog1.ShowDialog();
        if (dr == DialogResult. OK)
        {

                StreamReader sr = new StreamReader(openFileDialog1.FileName, Encoding. GetEncoding("Windows-1254"));
                string content = sr. ReadToEnd();

                sr. Close();

                content = Regex. Replace(content, textBox1.Text, textBox1.Text);

                StreamWriter sw = new StreamWriter(content);
                sw. Write(content);
                sw. Close();

            }

        }

A:

What do you want to replace with what?  string. Replace works fine, but you're replacing textBox1.Text with itself, which would obviously result in the same string.  You'd need something like this:
content = content. Replace(the-value-you-want-to-replace, the-value-you-want-to-replace-it-with);

