working with StreamReader and text files
<p>I want to put a test loop on the button click event. When I click this button, it reads the contents of the text file, but I want it to pop up an error message showing “unable to read file”, if it’s not a text file....
This is my code</p>

<pre><code>private void button3_Click(object sender, EventArgs e)
{
    StreamReader sr = new StreamReader(textBox1.Text);
    richTextBox1.Text = sr.ReadToEnd();
    sr.Close();
}
</code></pre>

<p>How can I go about it?</p>
