Hi all,
I'm New to VB 6.
I want to select a file from the directory like another applications.
How i can do that?

Recommended Answers

All 4 Replies

you need to use COMMON DIALOG CONTROL

as debasisdas said, use common dialog control

First you need to 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

this following code to use common dialog :

Private Sub btnBrowse_Click()
    CommonDialog1.Filter = "All files (*.*)|*.*"
    CommonDialog1.DialogTitle = "Select File"
    CommonDialog1.ShowOpen
    
    MsgBox CommonDialog1.FileName
End Sub
commented: Thank you.. +1

as debasisdas said, use common dialog control

First you need to 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

this following code to use common dialog :

Private Sub btnBrowse_Click()
    CommonDialog1.Filter = "All files (*.*)|*.*"
    CommonDialog1.DialogTitle = "Select File"
    CommonDialog1.ShowOpen
    
    MsgBox CommonDialog1.FileName
End Sub

Thank you debasisdas and Jx_man..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.