vb: how to use common dialog control - Open, Save As box?
This site provides users with the information about vb, visual basic, vb6, common dialog control, how to use common dialog control, common dialog box, display open dialog box, show save as dialog box, common dialog box filter, get file name, example, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to use common dialog control in vb?
The following is the code, example to create open, save as dialog box with filter and also show how to get file name from common dialog control in vb:
CommonDialog1.FileName = App.Path & "\*.*" 'show all file names
'CommonDialog1.InitDir = App.Path
'Specify default filter.
CommonDialog1.Filter = "All Files (*.*)|*.*|Text Files (*.txt)|*.txt
|html Files (*.html)|*.html"
CommonDialog1.FilterIndex = 2 ' Display the Open dialog box.
'CommonDialog1.FilterIndex = 1 ' Display the SaveAs dialog box.
'CommonDialog1.ShowSave 'open save as
FileName = CommonDialog1.FileName 'get file name
Open FileName For Append As #1
Print #1, "This is the appended line"