File Dialouge-> HALP!

Posts 1–6 of 6 · Page 1 of 1
File Dialouge-> HALP!
It always crashes whenever any of my testers close it.
[php]
OpenFileDialog1.Filter = "Dll Files (*.dll)|*.dll"
OpenFileDialog1.Title = "Browse for your .dll here..."
Dim filename As String
If OpenFileDialog1.Showdialog = Windows.Forms.DialogResult.OK Then
filename = IO.Path.GetFileName(OpenFileDialog1.FileName)
End if
[/php]

It wasn't working because you were trying to use the filename before they'd even set it, by using the "If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResultOK" the program will wait until the openfiledialog has been used before proceeding.
Alright thanks so much!
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        OpenFileDialog1.Filter = "DLL (*.dll) |*.dll|(*.*) |*.*"
        OpenFileDialog1.ShowDialog()
        Dim FileName As String
        FileName = OpenFileDialog1.FileName.Substring(OpenFileDialog1.FileName.LastIndexOf("\"))
        Dim DllFileName As String = FileName.Replace("\", "")
        Me.Dlls.Items.Add(DllFileName)
    End Sub
Tried doing what you said as-well. Throws errors. This is what the code is originally
Quote Originally Posted by LtRev View Post
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      
OpenFileDialog1.Filter = "DLL (*.dll) |*.dll|(*.*) |*.*"
        OpenFileDialog1.ShowDialog()
        Dim FileName As String
        FileName = OpenFileDialog1.FileName.Substring(OpenFileDialog1.FileName.LastIndexOf("\"))
        Dim DllFileName As String = FileName.Replace("\", "")
        Me.Dlls.Items.Add(DllFileName)
    End Sub
Tried doing what you said as-well. Throws errors. This is what the code is originally
[php]
Dim OFD as new OpenFileDialog
OFD .Filter = "Dll Files (*.dll)|*.dll"
OFD .Title = "Browse for your .dll here..."
Dim filename As String=""
If Not OFD .Showdialog = Windows.Forms.DialogResult.Cancel Then
filename = IO.Path.GetFileName(OFD .FileName)
Me.Dlls.Items.Add(filename )
End if [/php]

There you go !!
Can you be specific with what errors it's throwing please?
Posts 1–6 of 6 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us