c# - Open File Filter not working -


i making program open excel file in c# , data it.

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");     } } 

my problem code when open dialog appears, doesnt show file select. wrong in code?

  1. use asterisk in filter.
  2. possibly machine contains old style excel-files?

use filter:

open.filter = "excel (*.xls, *.xlsx)|*.xls;*.xlsx"; 

Comments