Created
April 30, 2015 13:03
-
-
Save NPS-ARCN-CAKN/98f6277365294c5df8ad to your computer and use it in GitHub Desktop.
VB .NET: An example OpenFileDialog function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Private Function OpenFile() As String | |
'build and configure an OpenFileDialog | |
Dim OFD As New OpenFileDialog | |
With OFD | |
.AddExtension = True | |
.CheckFileExists = True | |
.Filter = "Excel files(.xlsx)|*.xlsx|Excel files (*.xls)|*.xls" | |
.Multiselect = False | |
.Title = "Select an workbook to open" | |
End With | |
'show the ofd and if a file was selected return it, otherwise return nothing | |
If OFD.ShowDialog = Windows.Forms.DialogResult.OK Then | |
Return OFD.FileName | |
Else | |
Return Nothing | |
End If | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
super awesome, thanks