Solved

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

Posted on 2011-03-16
2
766 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

746 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

11 Experts available now in Live!

Get 1:1 Help Now