Skip to content

Instantly share code, notes, and snippets.

@JPeroutek
Created July 1, 2014 14:12
Show Gist options
  • Save JPeroutek/da8c45f10e9bd52411aa to your computer and use it in GitHub Desktop.
Save JPeroutek/da8c45f10e9bd52411aa to your computer and use it in GitHub Desktop.
openFileDialog 7/1/2014
Sub openFileDialog(ByVal sender As System.Windows.Forms.ToolStripMenuItem, ByVal e As System.EventArgs)
Dim myOpenFileDialog As New OpenFileDialog()
If Not sender.GetCurrentParent().Parent.Text = "" Then
myOpenFileDialog.InitialDirectory = sender.GetCurrentParent().Parent.Text
Else
myOpenFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
End If
myOpenFileDialog.Filter = "All files (*.*)|*.*"
myOpenFileDialog.FilterIndex = 1
myOpenFileDialog.RestoreDirectory = True
If myOpenFileDialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
sender.GetCurrentParent().Parent.Text = myOpenFileDialog.FileName
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment