Add this code to the Form1 class. Since the previous code uses the System. IO namespace, add the appropriate using or import statement at the top of the form. Call the set-up method from the previous step in the form's constructor or Load event-handling method. Add this code to the form constructor. Handle the NodeMouseClick event for treeview1 , and implement the code to populate listview1 with a node's contents when a node is clicked. If you are using C , make sure you have the NodeMouseClick event associated with its event-handling method.
You will see a split form containing a TreeView control that displays your project directory on the left side, and a ListView control on the right side with three columns.
You can traverse the TreeView by selecting directory nodes, and the ListView is populated with the contents of the selected directory. If avoiding the use of a dll or Ocx is not possible, then I am ready to use that dll or ocx, but it would be preferred if this could be done without a dll or ocx 3.
If each file could be displayed by its thumbnail instead of name, it would be nice but not an absolute necessity. I guess some simple code should already exist to do the above.
I would appreciate it if anybody could point me to such code. The picture shows to old Drive, Folder and File controls. These were even in outdated. The commonDialog control opens as a new popup window. What I need is something that remains on my VB Form at all times. I need it to display all the files in a folder including the file selected by the user at all times not just pop up when a commandbutton is clicked. Another problem with CommonDialog control is that it is not unicode-aware.
Let me clear up a few things first though. However, getting it to stay on the screen while you activate another form is another matter.
Typically, the common dialog windows are meant to be used in a modal fashion selecting what you need and then close them. However, again, what you suggest isn't a bad idea. If I were to attempt it, I'd start with LaVolpe's common dialog class. It's quite involved, but the big advantage is that he has the common dialog window all subclassed where you can monitor all the events. Once the common dialog window is loaded, you may be able to make some more API calls and turn off its modal status.
Once that was done, you'd need to monitor some other events to determine when a file was selected for processing. Then, you can possibly turn off its modal status and manipulate it like you're suggesting. Sorry, but I don't have the motivation to work it all out at this moment.
Almost everyone leaves those argument names the same. It's probably easier to "drive" from the GetOpenFileNameW side, set the hook, and then open another form in the hook procedure.
You can set that form as the owner of the common dialog form so that the common dialog stays on top. You'd still have some work to do to return the file names and to keep the common dialog form open. I've attached the little project where I was playing around with it. Also, with a bit of work, you could also make the common dialog form stay within the borders of whatever additional form you opened. Attached Files MessingAround. My contemporary VB6 project is approaching 1, modules.
To all, peace and happiness. To ensure unicode aware substitution of VB controls, you are probably looking at a user-control. Krool offers a suite of unicode-aware replacements. You might want to look at his project? I'm not sure of why the "dialog" must be a VB form, but if that is a requirement I think you can find Explorer-like projects in this forum.
Many of them attempt to replicate Explorer, including the use of listviews to display files by name, icon, etc. Insomnia is just a byproduct of, " It can't be done" Classics Enthusiast? Here's my Mustang Mach I Fastback. Her sister '67 Coupe has been adopted Newbie? Spend a few minutes browsing the FAQ section of the forum.
All the buttons can be hidden at once with the ListControlBox property. It's indeed a powerful control, but I've tried to make it easy to use, and easy to configure into simpler user modes.
All the customizations shown in the various pictures here and in the project thread are accomplished through design-time properties, not code changes, and all the properties have descriptions clarifying their function.
It supports renaming files, in place just like in Explorer using the ListView labeledit. If you rename a file outside the control, it watches events and will update to the new name automatically as long as the MonitorDirChanges property is enabled it is by default.
There's events for when there's a double-click or Enter keypress, but if you wanted a 'Process' button you could add one on your form and just use the. SelectedFile property when it's clicked you can choose between single- and multi- select. If you are only processing some file types, there's even an ItemFilter property such that you can show only those files you support.
It can also meet all 3 points, -Fully unicode aware for all features -You need not use it as an ocx; I never do. The UserControl just requires that single. Also, if you're using thumbnail mode, Common Controls 6 manifest goes from recommended to required; the resource file included for the demo has one, your IDE will need one if running from there. LaVolpe has a tool that makes all this easy if you aren't already using one. I've put a lot of work into making the control highly customizable.
If you have any questions or issues etc you can also post in the thread or PM me, always happy to help. Mimicking Explorer, to a better degree than the built-in file controls in VB something you presumably need to not just be using those , is a complicated task no matter how you slice it, particularly if you want directory navigation and thumbnails.
You could certainly find something with fewer features than my controls, but I haven't seen any that would be easier to actually work with. Since it's such a egregious oversight, I put out an immediate update to add it, so if you need that option, grab v5.
It would also need an update to the tree control to avoid a bug this way introduces; it's done and I'll send it but I wasn't going to update the public release yet. Last edited by fafalone; Jan 11th, at AM. ComboBoxes , And More! My post 6 would still need substantial work, and it seems that Fafalone has done it all for you. You may also try it with the WebBrowser control if you like Navigate2 Text1.
Didn't test it so I don't know if it's what you need or not Attached Files vbexplorer. Thanks a lot for your response. I think I should use this great control that you have developed. Before I start downloading and testing it, I need to understand a few things, because at this moment I am not sure how to test it: 1. How many things should I download and put together? I know I have to download " ucShellBrowse The thumbnail size can be set to any value.
You are also strongly recommending: Common Controls 6. So, does it mean that I have to also download and install that " Manifest Creator.
Add "Type" lvColumnHeader. Add "Date Modified" lvColumnHeader. Actually it didn't need multiprocessing. Renee Your posts here have been no more pitifull than your other recent posts. But it's nice to know that you are beginning to realize the current state of your mind. John, Persons trained in Microsoft don't think my posts are at all pitiful. Renee lol. That's bound to be helpful.
Smith 0. EventArgs Handles MyBase. Load TreeView1. Top Or AnchorStyles. Bottom Or AnchorStyles. Left Or AnchorStyles. Add "File Name" , , HorizontalAlignment. Add "Path" , , HorizontalAlignment. Clear ListView1. Clear Me. MyComputer Else fbd. GetFileInfo folderToView. FullName End If Else. MyComputer End If. IsReady Then MessageBox. Empty Then Me. WaitCursor Me.
FullPath End If Me. WaitCursor ListView1. Default End If Me. Default Else Me. EventArgs Handles ListView1. Text End If Process. Name rootNode. GetDirectories , rootNode TreeView1. System And Not subDir. Name, 0, 0 aNode. GetDirectories If subSubDirs. UnauthorizedAccessException ' There's nothing we can do about it Catch ex As Exception MessageBox.
DirectoryExists folder Then ListView1. GetFiles folder, FileIO. GetFileInfo f. Add partialPath ListView1. EndUpdate Else ListView1. GetFileInfo filePath. Wow, did you do this on your own Frank?
Looks good - Might come in handy one day for reference :. Looks good - Might come in handy one day for reference : Do it on my own? Haha funny guy eh? Saturday, October 30, PM. When you post massive amounts of code that depends upon designer code, post the project to your SkyDrive if you post it for others to use.
Sorry about that. It also depends upon a designer, which isn't posted. Connect and share knowledge within a single location that is structured and easy to search. I'm making a File Explorer in VB. Everything is going fine except one thing. When you click the dynamically created label to "open" a folder, I need to get the value of the label so I can set a variable to it. I can't get the value because the label was dynamically create. Therefore the object doesn't exist. Here's my code:. The event handler's sender parameter contains the label that generated the event.
You can cast it back to Label by writing CType sender, Label. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
Create a free Team What is Teams? Collectives on Stack Overflow.
0コメント