open txt file by using OpenFileDialog in c#
<p>i write the following code to open txt file     </p>

<pre><code>private void button1_Click(object sender, EventArgs e)
{
    try
    {
        OpenFileDialog reader = new OpenFileDialog();

        reader.Filter = "txt files (*.txt)|*.txt";
        // reader.Title = "";
        reader.ShowDialog();
        rtb1.LoadFile(reader.FileName);
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}      
</code></pre>

<p>but this code is give the following error:<br>
<strong>Error:</strong><br>
    File format is not valid</p>
