Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2011-03-16
2
Medium Priority
?
818 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

670 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