tags:

views:

1482

answers:

3

Am New to VB 6

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

Need VB 6 Code Help.

A: 

Why don't you use MSDN or search on google for such a thing first?

If you are new, read some books/articles & get yourself acquainted.
If you don't find anything in help/MSDN/google, ask on SO.

There is Microsoft Common Dialogs Control that you can use to do that.
Press CTRL + T, you will see a number of activex controls, pick the microsoft common dialogs control.

shahkalpesh
A: 

Save time with VB6's Common Dialog control

And here is the search string I typed into google "file open dialog vb6" - first result.

Gishu
A: 

There's some example code in this question. Quoting:

In VB6, add the component:

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

Now on your form, add the new Common Dialog control from the toolbox

In code, you need:

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

'The FileName property gives you the variable you need to use
MsgBox CommonDialog.FileName
Ant