Opening

As you can see from my name, im not great at vb, but ive set a target, and im determined to reach it, my progs gonna be a file organizer

First off, i need to now how to use the openfiledialog


Answer this question

Opening

  • northern

    Try here pal...

    http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpref/html/frlrfsystemwindowsformsopenfiledialogclasstopic.asp


  • Christopher

    The above code will open the selected file with a Stream, allowing you to read the content of the file. If you don't need to read the content of the file, you can remove the myStream code and simply use openFileDialog1.FileName to get back the name of the selected file.

    Best regards,

  • Karen Chen

    Thanks that was useful

    Im using this code for the openfiledialog:


    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    Dim myStream As IO.Stream

    Dim openFileDialog1 As New OpenFileDialog()

    openFileDialog1.InitialDirectory = "c:\"

    openFileDialog1.Filter = "exe files (*.exe)|*.exe|All files (*.*)|*.*"

    openFileDialog1.FilterIndex = 2

    openFileDialog1.RestoreDirectory = True

    If openFileDialog1.ShowDialog() = DialogResult.OK Then

    myStream = openFileDialog1.OpenFile()

    If Not (myStream Is Nothing) Then

    ' Insert code to read the stream here.

    myStream.Close()

    End If

    End If

    End Sub


     


    But does it mean by:

    ' Insert code to read the stream here.



  • Opening