Member Avatar for SpiffyCS

Is there a way to search a drive's files only for a specific file format, then display them to the user (and stored somewhere to be used later)? Maybe with the Shell, but I don't know how to use it very well.

At the moment, I have a dropdown to select a drive, a text entry field for the user to enter the extension, a "Search" button to actually search for the files, and a file list box to show the files using the extention (hopefully).

Is there a way to do this in VB6?

Recommended Answers

All 9 Replies

Be aware that VB6's functions are slightly broken under Windows 10. I know because of a legacy app I maintain for our company. This is why I'm going to tell you this is a very bad idea today. I can't guess why this must be in VB6 but will warn you off before you invest with time and code.

In psuedo code this is what failed a few months ago:

Show a list of files in the current directory. Permissions are checked so that's not the problem.
VB6 code opens a file and the error is the usual file not found.
More debugging and we log the current directory and what VB6's own file functions see in that folder yet the file will not open.

I did find a workaround but this area is broken with no signs from anyone that it will be fixed.

commented: thanks +0
Member Avatar for SpiffyCS

I'm only making this in VB6 because it's really easy to get into and I like old, "retro" stuff. I'm happy to move over to .NET or something else if I need to, I just get really confused with what I'm doing with those and the Microsoft website doesn't provide any useful information.

Is there anything you'd recommend to switch to from VB6?

Then let's see your code. Sometimes new members want others to write the code for them but forget to put in a full design document and how much the job pays.

Your top post seems to infer you have something going but fails to mention:

  1. What's stopping you?
  2. Is there a code passage that is a stumper?
  3. There's not a lot of design description there. The author is making assumptions we'll know what the client wants.
Member Avatar for SpiffyCS

It's just a side project I'm doing for fun, it just lets you locate folders and delete or copy them somewhere else. The only thing stopping me is not know how to implement that kind of thing, searching for a certain file (or in this case a file extension).

I was just wondering if there was a way to search through files on a computer, or if VB6 can't do something like that.

I noted that VB6 is broken in areas now (Windows 10) so you will have to discover these issues and work around it. I noted one issue we encountered and I can't imagine any production app today or even hobbiest that would put up with this.

VB6 can do this but again, there are broken areas that will sink the casual programmer.

Member Avatar for SpiffyCS

Are there any modern alternatives to VB6?

commented: I always thought that would be VB.net. Worth the time to learn this and C#. +15

Execute a shell command:

dir C:\*.txt /s/b > C:\txtfile.txt

This will output all files with extension .txt on drive C to the file at the end. VB has a ShellExecute function you can use to execute this. After it's done, open the file and process the results.

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.