Visual Basic help!

Status
Not open for further replies.

romeo_8693

"The RaCaLaNGeL"©
i want to add a control which opens "open file" dialog!but it shudnt take a file instead i just want the folder path to be returnd to prog.how do i do this?
 
OP
romeo_8693

romeo_8693

"The RaCaLaNGeL"©
i know its common dialog control,but it if select a folder and click open it opens the folder..i dnt want dat...instead of open button a want sumthing like select,so wen a select the folder and click select it passes the path of that folder and not opn it....
 
Ok so this is the thing.I hope that u must be knowing DirListBox which displays the folder of a particular drive .First u can use the DriveListBox then the DirListBox. Need answer in detail ?????????????
 
I got that .

Can u see the folder icon and a drive icon in the tollbar containing commands.You can select the drive for the drives and folder for the folders.

For details on how to use them rep.
 
Ok so lets begin :-

U can see that in the general toolbar of VB6 there r thre icons(circled in the image) :-
*www.geocities.com/siddharth_bhoot/take/123.JPG


The drive icon is for drive scroller , folder icon for folder box and file icon for file box.

Now if uwant to set the path of the folder to the drive so in the change value of drive put the following line:-
Code:
dir1.path=drive1.drive

So whenever the user will change the drive the folders will get updated.

Now suppose if uwant to show the caption of the form = the location where the user is browsing.
so put the following command:-
Code:
form1.caption=dir1.path

I have also created a sample rough project (Especially for u) to give an example.

Reply if this helped you or if u have a question.But plz do reply.
 
Last edited:

deepak.krishnan

In the zone
Kerry said:
Hi dude! Could you please advise me where I can get a good tutorials for VB6?
Try this site:
www.freevbcode.com
Its a great one.
__________
romeo_8693 said:
i want to add a control which opens "open file" dialog!but it shudnt take a file instead i just want the folder path to be returnd to prog.how do i do this?
For that you will have add a CommonDialog control which if not present in the toolbar, you will have to add from the Components(ctrl+t)
Then, to show the open dialog box,
add the foll. code in the event in which you want the open dialog box to appear.
Code:
cd.Filter = "AllFiles|*.txt"
FileName = cd.FileName
cd.ShowOpen
frmmain.Caption = cd.FileName
In the above code, cd is the name of the common dialog box. Then the FileName is an inbuilt keyword in VB which give the filename of the file selected in the Dialog box.
.Filter is used to display only a set of files which have a specific extension such as .exe,.txt etc.
After that,I have displayed the file name in the form,s caption using the last line of code.
If you want the whole path and the file name to be displayed, use the following code:
Code:
frmmain.caption=cd.Path + "/" + cd.FileName
If there is any error, just let me know....I will correct it if you want!!!
 
Last edited:
OP
romeo_8693

romeo_8693

"The RaCaLaNGeL"©
@sid...
dude that works but not exactly how i want it...the way i want is:if u have winamp then there is a option to add directory to playlist...wen u click it,it opens a dialog box to select a folder(tree view)...i want it this way...
 

deepak.krishnan

In the zone
romeo_8693 said:
@sid...
dude that works but not exactly how i want it...the way i want is:if u have winamp then there is a option to add directory to playlist...wen u click it,it opens a dialog box to select a folder(tree view)...i want it this way...
Did you try what I said??? Is that what you wanted???
 
Status
Not open for further replies.
Top Bottom