File Open Dialog

I am trying to code to get the File Open dialog.How do I do it

Can anyone post a sample code, please



Answer this question

File Open Dialog

  • Aengus

    Try this:



    Using dialog As New OpenFileDialog()
    If dialog.ShowDialog() = DialogResult.OK Then
    MessageBox.Show(dialog.FileName)
    End If
    End Using



  • manhatma

    Thanks a ton for all your help.

    I tried this one and was successful.

    Using the CommonDialog Control I was able to bring up the Open Dialog.

    CommonDialog1.ShowOpen


  • Yogesh Roy MSFT

    Try this:

    Dim dialog As New OpenFileDialog()

    If dialog.ShowDialog() = Windows.Forms.DialogResult.OK Then

    MessageBox.Show(dialog.FileName)

    End If



  • Marcus Ogden

    I am sorry to have not mentioned this before.

    I am using VB6.


  • StevenSw

    Thanks for the Sample code!

    However, I seem to be getting syntax error for :

    Using dialog As New OpenFileDialog()End Using
    End Using




  • José Nelson

    Sorry, what version of Visual Basic are you using

    That looks like VB6 code.



  • File Open Dialog