Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 826
  • Last Modified:

Open dialog box in vb.net 2005 with all extentions of excel

Hi,

I have a code to open specific excel extentions.How can I open all extentions of excel.


 o.Title = "Select the file to open"
            'Excel 2007 Log 8321:

 Dim o As New OpenFileDialog()
            o.Filter = "Excel Spreadsheets (*.xls)|*.xls|Excel Spreadsheets (*.xlsx)|*.xlsx" ---Need to change here to display all excel extentions
            If o.ShowDialog = Windows.Forms.DialogResult.OK Then
               If o.FileName <> String.Empty Then
                  myFiles = Split(o.FileName, vbNullChar)

                  txtInputFile.Text = (myFiles(0))
               End If
            End If


Any suggestions appreciated.

Cheers
0
RIAS
Asked:
RIAS
  • 2
1 Solution
 
Asim NazirCommented:
Hi,

Use this line:
"Excel Spreadsheets (*.xls;*.xlsx)|*.xls;*.xlsx"

Asim
0
 
Asim NazirCommented:
Code will become:

 
Dim o As New OpenFileDialog()
        o.Filter = "Excel Spreadsheets (*.xls;*.xlsx)|*.xls;*.xlsx"
        If o.ShowDialog = Windows.Forms.DialogResult.OK Then
            If o.FileName <> String.Empty Then
                myFiles = Split(o.FileName, vbNullChar)

                txtInputFile.Text = (myFiles(0))
            End If

Open in new window

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now