Dialog Component Overview
📖 Introduction
cDialog is a Windows standard dialog wrapper class providing common dialog functionality such as open file, save file, select folder, supporting file filtering, multi-select, and other features.
✨ Key Features
| Feature | Description |
|---|---|
| Open File Dialog | Supports single select, multi-select, file filtering |
| Save File Dialog | Supports overwrite prompt, default extension |
| Select Folder Dialog | Supports new style dialog |
| Preset Filters | Text, image, document, code and other preset filters |
| File Path Utilities | Extract path, filename, extension, etc. |
| Open File | Open selected file using ShellExecute |
🚀 Quick Start
Open File
vb
Dim dlg As New cDialog
dlg.DialogTitle = "Select File"
dlg.InitialDir = "C:\Documents"
dlg.AddFilter "Text Files", "*.txt"
dlg.AddFilter "All Files", "*.*"
Dim filePath As String
filePath = dlg.ShowOpen
If filePath <> "" Then
Debug.Print "Selected file: " & filePath
End IfSave File
vb
Dim dlg As New cDialog
dlg.DialogTitle = "Save File"
dlg.DefaultExt = "txt"
dlg.FileName = "New Document.txt"
dlg.AddFilter "Text Files", "*.txt"
Dim savePath As String
savePath = dlg.ShowSave
If savePath <> "" Then
Debug.Print "Save to: " & savePath
End IfSelect Folder
vb
Dim dlg As New cDialog
dlg.DialogTitle = "Select Folder"
Dim folderPath As String
folderPath = dlg.ShowBrowseForFolder
If folderPath <> "" Then
Debug.Print "Selected folder: " & folderPath
End IfUsing Preset Filters
vb
Dim dlg As New cDialog
' Use image filter
dlg.SetImageFilters
Dim imgFile As String
imgFile = dlg.ShowOpen
' Use document filter
dlg.SetDocumentFilters
Dim docFile As String
docFile = dlg.ShowOpenUsage Example
vb
'-----------------------------------------------
' Event: btnBrowse_Click (Browse button)
' Description: Open file selection dialog
'-----------------------------------------------
Private Sub btnBrowse_Click()
With New cDialog
.ClearFilter
.AddFilter "All Files (*.*)", "*.*"
.DialogTitle = "Select file to upload"
.FileMustExist = True
.PathMustExist = True
With .SelectFiles()
If .Count > 0 Then
mSelectedFile = .Item(1)
txtFilePath.Text = mSelectedFile
lblStatus.Caption = "File size: " & VBMAN.Formater(FileLen(mSelectedFile)).ReturnFileSize()
btnUpload.Enabled = True
End If
End With
End With
End Sub📁 Documentation Navigation
- properties.md - Properties detailed reference
- methods.md - Methods detailed reference
Last Updated: 2026-05-17