Open File Filter not working
<p>I am making a program to open an Excel file in C# and get the data from it.</p>

<pre><code>private void XLConnect_Click(object sender, EventArgs e)
{
    type = 1;
    open.Filter = "Excel|.xlsx";
    open.ShowDialog();
}

public void readFile()
{
    if (type == 1)
    {
        MessageBox.Show("Success");
    }
}
</code></pre>

<p>My problem with the code is that when the open dialog appears, it doesnt show any file to select. What is wrong in the code?</p>
