I want to select a file from the directory or other system. How to use open file dialog in VB 6?
There's some example code in this question. Quoting:
In VB6, add the component:
Now on your form, add the new Common Dialog control from the toolbox
In code, you need:
CommonDialog1.Filter = "Apps (*.txt)|*.txt|All files (*.*)|*.*"
CommonDialog1.DefaultExt = "txt"
CommonDialog1.DialogTitle = "Select File"
CommonDialog1.ShowOpen
'The FileName property gives you the variable you need to use
MsgBox CommonDialog1.FileName
it needed the "1", but works great thank you
CommonDialog1.Filter = "Apps (*.txt)|*.txt|All files (*.*)|*.*"
CommonDialog1.DefaultExt = "txt"
CommonDialog1.DialogTitle = "Select File"
CommonDialog1.ShowOpen
'The FileName property gives you the variable you need to use MsgBox CommonDialog1.FileName
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With