Find Code:
All Words
Any of the Words
Exact Phrase
Home
:
Code
:
Forums
:
Submit
:
Mailing List
:
About
:
Contact
Code
All
VB.NET
ASP.NET
C#
VB Classic
ASP Classic
Snippets
Popular
Resources
Submit Code
Forums
Articles
Tips
Links
Books
Contest
Link to us
File or Folder Dialog
Author:
Theodore Dinozzo
E-mail:
Click to e-mail author
Submitted:
10/26/2011
Version:
VB 2010
Compatibility:
VB 2010
Category:
File Manipulation
Views:
8801
Use this class to show a file or folder dialog like this: To let the user find a winrar file do this: Dim i As Dialogs i = New Dialogs("Please Find a WinRar file", "WinRar Files |*rar") i.FileDialog() To let him find a folder do this: Dim i As Dialogs i = New Dialogs("Please Find a Folder", "") i.FolderDialog()
Declarations:
Imports System.IO
Code:
Public Function FolderDialog() FolderDialog = "" Dim FolderBrowserDialog1 As New FolderBrowserDialog With FolderBrowserDialog1 .RootFolder = Environment.SpecialFolder.Desktop .SelectedPath = Environment.SpecialFolder.Desktop .Description = MessageToShow If .ShowDialog = DialogResult.OK Then FolderDialog = (.SelectedPath) End If End With End Function Public Function FileDialog() FileDialog = "" Dim fdlg As OpenFileDialog = New OpenFileDialog() fdlg.Title = MessageToShow fdlg.InitialDirectory = Environment.SpecialFolder.MyDocuments & "\Downloads" fdlg.Filter = FiltersToShow fdlg.RestoreDirectory = True If fdlg.ShowDialog() = DialogResult.OK Then If Not fdlg.FileName = "" Then If File.Exists(fdlg.FileName) Then FileDialog = (fdlg.FileName) End If End If End If End Function End Class
Home
|
Forums
|
Submit
|
Books
|
Mailing List
|
Advertising
|
About
|
Contact
© 2024 A1VBCode. All rights reserved.
Legal disclaimer & terms of use
Privacy statement