We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,188 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Open file dialog

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?

3
Contributors
4
Replies
6 Hours
Discussion Span
2 Years Ago
Last Updated
5
Views
Question
Answered
Sturdy
Light Poster
39 posts since Mar 2011
Reputation Points: 28
Solved Threads: 1
Skill Endorsements: 0

you need to use COMMON DIALOG CONTROL

debasisdas
Posting Genius
6,968 posts since Feb 2007
Reputation Points: 722
Solved Threads: 457
Skill Endorsements: 20

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
Jx_Man
Senior Poster
3,529 posts since Nov 2007
Reputation Points: 1,488
Solved Threads: 521
Skill Endorsements: 64

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
Jx_Man
Senior Poster
3,529 posts since Nov 2007
Reputation Points: 1,488
Solved Threads: 521
Skill Endorsements: 64
Question Answered as of 2 Years Ago by Jx_Man and debasisdas

Thank you debasisdas and Jx_man..

Sturdy
Light Poster
39 posts since Mar 2011
Reputation Points: 28
Solved Threads: 1
Skill Endorsements: 0

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0856 seconds using 2.65MB