Silly VB 2005 question.

deicistdeicist Manchester, UK
edited August 2006 in Internet & Media
Okay, I'm building a small app that will take a folder full of files and sort those files according to where the user wants to put them in a directory tree. Basiclaly the user will point the app at a folder and hit 'go' and for every files in that folder it will pop up a dialog with a directory tree on it for the user to either select a folder to put the file in, or create a new folder, or delete the file. Now, my problem is I want to display a directory tree that might not have a drive as it's root. For example if I have:

c:\archive\folders\folder1
c:\archive\folders\folder2
etc..

I want the root of the tree to be c:\archive\folders not c:\

I can do this by writing a function to recurse through the folders from the root and build my own tree but that's a little time intensive and I'd like to use a built in component if there is one. Anyone got any ideas?

Comments

  • edited July 2006
    Not to question your experience...but your title says guru. If you are such a "guru" shouldn't you know the components? Is Visual Basic the only programming language you know, or are learning?

    Cause in my opinion there are other languages that will code this more effiently.
  • edited July 2006
    I do not know what components are in 2005, since i use 6. But what about the FileSystemObject component?
    In VB6 its easy to move a file: In what ever form or module:

    Dim fso as New FileSystemObject
    fso.MoveFolder "C:\Archive\Folders\Folder1", "C:\Archive\Folders\Folder2"

    But that is VB6. Sorry I can't help with 2005, I sort of dropped Microsoft languages after VB6 and moved on to better things.
    Just fyi: The File System Object component is neat, but its very limited. Limited in the fact, you can't read and write to a text file, you can't use wildcards for folders(and files in some cases), FileSystemObject allows creating ASCII or Unicode text files, FileSystemObject can read only ASCII text files. Although not much of this information is useful to ur problem, hence the fyi.

    The other way i know of doing it is using the SHFileOperation API. I'm sure you know of this. So its just another way to move a folder. This API is way more useful than the FSO component. Unfortunatly these are VB6 things i know. I also know the VB6 code, w.o using components. Just straight code. But here we go, its VB6. Sorry I can't be more of a help.
  • primesuspectprimesuspect Beepin n' Boopin Detroit, MI Icrontian
    edited July 2006
    His title is "guru" because he is a short-media guru - a staff member.
  • edited July 2006
    His title is "guru" because he is a short-media guru - a staff member.

    Sorry prime i didnt mean it to sound like an attack, but I recieve flack about all my stuff on other forums. So when people post on the forum with the label of guru, or on others as "Master Programmer" or something and don't know what they are doing, I sorta critique their title. My Bad. Truly sorry. By no means is deicist not a guru in other respects of computers. :honoes:
  • deicistdeicist Manchester, UK
    edited August 2006
    Um, thanks for the help Mike but if you read my original post I'm not looking for a way to move files or folders, I'm looking for an easy (built in) way to display a folder tree built from a defined root rather than doing it programmatically by recursing through the tree. I'm using VB because it's quick and easy, I knocked this app up in 5 minutes and it does what I want it to. I could have used Delphi, or C++, or Ruby, or PHP or something else 'more efficient' but in my experience I've found that VB is perfect for those little 5 minute apps.

    Incidently I'm a 'guru' because I actually read other people's posts and try and help them, rather than reading half the post and then replying with something completely irrelevant.
  • edited August 2006
    Damn your a fiesty one aren't ya. Well sorry that I misunderstood your post. I try to say sorry, but its just like the other forums...they all be hatin. Here you mean something like this, where the control is ctrl.

    ctrl.InitDir = "c:\archive\folders"
    ctrl.ShowOpen
    if ctrl.FileName = "" Then
    Else
    End If

    If thats not what u mean, im sure that:

    ctrl.InitDir = "c:\archive\folders"

    Would be helpful.
  • deicistdeicist Manchester, UK
    edited August 2006
    Sorry if it came across as feisty, but to be fair you were hardly polite in your posts. Anyway, the folderbrowserbox in VB 2005 doesn't have an initdir property, just a selecteddir which allows you to set the initial selected directory. I don't think it's possible to do what I want using built in components and properties so I'll have to do it the long way but thanks for your help.
  • edited August 2006
    deicist wrote:
    Sorry if it came across as feisty, but to be fair you were hardly polite in your posts. Anyway, the folderbrowserbox in VB 2005 doesn't have an initdir property, just a selecteddir which allows you to set the initial selected directory. I don't think it's possible to do what I want using built in components and properties so I'll have to do it the long way but thanks for your help.

    :( I think I might consider keeping VB6 and VB 2005 on computer. The syntax is different and i noticed on someone else computer that the menus are more of a nuisance to create. Well sorry I couldnt be of more help.
Sign In or Register to comment.