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

x
?
Solved

VB.net button file chooser

Posted on 2007-04-03
4
Medium Priority
?
2,323 Views
Last Modified: 2013-11-26
How do I make a vb.net button that will open a file browser and browse for a *.xml file for the user to select?
0
Comment
Question by:dprundle
[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
4 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 18846571
0
 

Author Comment

by:dprundle
ID: 18846647
I don't need to browse for a folder, I need to browse for an XML file.
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 18846858
Use the OpenFileDialog():
http://msdn2.microsoft.com/en-us/library/system.windows.forms.openfiledialog.aspx

Something like...

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim ofd As New OpenFileDialog
        ofd.Title = "Please select an XML file"
        ofd.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*"
        If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
            Dim fi As New System.IO.FileInfo(ofd.FileName)

            ' do something with "fi"...
            Debug.Print(fi.Name)
            Debug.Print(fi.DirectoryName)
            Debug.Print(fi.FullName)

        End If
    End Sub
0
 

Author Comment

by:dprundle
ID: 18846999
idle_mind you are amazing. thanks again
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

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

How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
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…
THe viewer will learn how to use NetBeans IDE 8.0 for Windows to perform CRUD operations on a MySql database.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

704 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