Solved

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

Posted on 2011-03-16
2
776 Views
Last Modified: 2012-05-11
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
Comment
Question by:RIAS
  • 2
2 Comments
 
LVL 10

Expert Comment

by:Asim Nazir
ID: 35146173
Hi,

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

Asim
0
 
LVL 10

Accepted Solution

by:
Asim Nazir earned 500 total points
ID: 35146184
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now