How to use open file dialog box in VB 6?

Am New for VB 6

I want to select a file from a directory or another system. How to use file open dialog in VB 6?

Help for VB 6 code required.

+5
source share
2 answers

Here is an example code in this question . Citation:

In VB6 add the component:

  • Project> Components
  • On the Management tab, select Microsoft Common Dialog Control 6.0 (SP6)

Now in your form add a new Common Dialog control from the toolbar

In the 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
+15
source

he needs "1" but it works great

CommonDialog1.Filter = "Apps (*.txt)|*.txt|All files (*.*)|*.*"
CommonDialog1.DefaultExt = "txt"
CommonDialog1.DialogTitle = "Select File"
CommonDialog1.ShowOpen

' FileName ,   MsgBox CommonDialog1.FileName

+1

All Articles