By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,007 Members | 1,023 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,007 IT Pros & Developers. It's quick & easy.

Help Needed with Treeview control

P: n/a
Hi all,

I'm fairly new to VB.NET but have more experience with VB6 and earlier.
I'm trying to create an application that will move files from one
folder to another. Here is the scenario.

I have a folder on my local hard drive that has about 1400 .XLS files.
These files are all named with the same pattern of call#_Serial #.xls.
I need to move these to a folder on the network. the network folder
structure is based on serial #. So what I want to do is read through
the files on my local hard drive (particular folder only) then parse
out the serial number from the file name, find that folder on the
network (subfolder of a main folder) and move the file there.

I've built a form that populates a tree control with the files from the
source directory and them I'm stuck on how to proceed from there.

Any help that someone can give me on this would be appreciated.

Thanks

Craig

Jan 4 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
First of all, if you have an expectation that, when you post a message via
Google Groups, the message will be 'published' instantly, then please
disabuse yourself of that expectation. Messages can take some minutes to get
'published'. There is nothing more annoying than people posting messages
multiple times, and even more so when they are only a few seconds apart.

If you want the 'number' part of the filename when all the filenames conform
to that pattern, all you need to do is something like:

Dim _ss As String() = _filename.Split("#"c")
Dim _targetfolder as String = _ss(1)

The 'number' part will always be found in the 2nd element of the array
returned by the Split method.
"Saabster" <cb******@sbcglobal.netwrote in message
news:11*********************@v33g2000cwv.googlegro ups.com...
Hi all,

I'm fairly new to VB.NET but have more experience with VB6 and earlier.
I'm trying to create an application that will move files from one
folder to another. Here is the scenario.

I have a folder on my local hard drive that has about 1400 .XLS files.
These files are all named with the same pattern of call#_Serial #.xls.
I need to move these to a folder on the network. the network folder
structure is based on serial #. So what I want to do is read through
the files on my local hard drive (particular folder only) then parse
out the serial number from the file name, find that folder on the
network (subfolder of a main folder) and move the file there.

I've built a form that populates a tree control with the files from the
source directory and them I'm stuck on how to proceed from there.

Any help that someone can give me on this would be appreciated.

Thanks

Craig

Jan 4 '07 #2

P: n/a
Actually the double posting was a problem with the beta google groups
interface. for some reason it was hung up and when I trued to refresh
it, it posted twice. I did delete the 2nd erroneous posting as soon as
I saw it. so my apologies for that. I agree I hate seeing multiple
postings as well and usually use a new reader, but as this is a group I
spend little time in, I used Google instead.

Next Thanks for the info on parsing out the serial number. I took a
longer way since I did not know about the split method.

Once I have the target folder name how can find that in a network tree
structure that can be buried 3 levels deep and is not named the serial
number but instead is called "Serial Number 123456-456712"? So I guess
I 'm asking is how do I traverse a directory structure and find a 1
folder out of over 1000 that has my serial number in its name?

Thanks

Craig
Stephany Young wrote:
First of all, if you have an expectation that, when you post a message via
Google Groups, the message will be 'published' instantly, then please
disabuse yourself of that expectation. Messages can take some minutes to get
'published'. There is nothing more annoying than people posting messages
multiple times, and even more so when they are only a few seconds apart.

If you want the 'number' part of the filename when all the filenames conform
to that pattern, all you need to do is something like:

Dim _ss As String() = _filename.Split("#"c")
Dim _targetfolder as String = _ss(1)

The 'number' part will always be found in the 2nd element of the array
returned by the Split method.
"Saabster" <cb******@sbcglobal.netwrote in message
news:11*********************@v33g2000cwv.googlegro ups.com...
Hi all,

I'm fairly new to VB.NET but have more experience with VB6 and earlier.
I'm trying to create an application that will move files from one
folder to another. Here is the scenario.

I have a folder on my local hard drive that has about 1400 .XLS files.
These files are all named with the same pattern of call#_Serial #.xls.
I need to move these to a folder on the network. the network folder
structure is based on serial #. So what I want to do is read through
the files on my local hard drive (particular folder only) then parse
out the serial number from the file name, find that folder on the
network (subfolder of a main folder) and move the file there.

I've built a form that populates a tree control with the files from the
source directory and them I'm stuck on how to proceed from there.

Any help that someone can give me on this would be appreciated.

Thanks

Craig
Jan 4 '07 #3

P: n/a
Ahhhh ... Another good reason to avoid Google Groups like the plague :)

Ummm ... How about:

Dim _targetfolder As String = "Serial Number " & _ss(1)

Surely you must know the base path to where your target folders are stored.
"Saabster" <cb******@sbcglobal.netwrote in message
news:11**********************@q40g2000cwq.googlegr oups.com...
Actually the double posting was a problem with the beta google groups
interface. for some reason it was hung up and when I trued to refresh
it, it posted twice. I did delete the 2nd erroneous posting as soon as
I saw it. so my apologies for that. I agree I hate seeing multiple
postings as well and usually use a new reader, but as this is a group I
spend little time in, I used Google instead.

Next Thanks for the info on parsing out the serial number. I took a
longer way since I did not know about the split method.

Once I have the target folder name how can find that in a network tree
structure that can be buried 3 levels deep and is not named the serial
number but instead is called "Serial Number 123456-456712"? So I guess
I 'm asking is how do I traverse a directory structure and find a 1
folder out of over 1000 that has my serial number in its name?

Thanks

Craig
Stephany Young wrote:
>First of all, if you have an expectation that, when you post a message
via
Google Groups, the message will be 'published' instantly, then please
disabuse yourself of that expectation. Messages can take some minutes to
get
'published'. There is nothing more annoying than people posting messages
multiple times, and even more so when they are only a few seconds apart.

If you want the 'number' part of the filename when all the filenames
conform
to that pattern, all you need to do is something like:

Dim _ss As String() = _filename.Split("#"c")
Dim _targetfolder as String = _ss(1)

The 'number' part will always be found in the 2nd element of the array
returned by the Split method.
"Saabster" <cb******@sbcglobal.netwrote in message
news:11*********************@v33g2000cwv.googlegr oups.com...
Hi all,

I'm fairly new to VB.NET but have more experience with VB6 and earlier.
I'm trying to create an application that will move files from one
folder to another. Here is the scenario.

I have a folder on my local hard drive that has about 1400 .XLS files.
These files are all named with the same pattern of call#_Serial #.xls.
I need to move these to a folder on the network. the network folder
structure is based on serial #. So what I want to do is read through
the files on my local hard drive (particular folder only) then parse
out the serial number from the file name, find that folder on the
network (subfolder of a main folder) and move the file there.

I've built a form that populates a tree control with the files from the
source directory and them I'm stuck on how to proceed from there.

Any help that someone can give me on this would be appreciated.

Thanks

Craig

Jan 4 '07 #4

P: n/a
I have the base path mapped as a drive letter so yes I know that, but
the problem is there are subfolders within subfolders. the actual
target folder can be up to 3 levels deeper than the base path.
Will VB.NET beable to find it without having the full path? If so how?

Thanks

Craig
Stephany Young wrote:
Ahhhh ... Another good reason to avoid Google Groups like the plague :)

Ummm ... How about:

Dim _targetfolder As String = "Serial Number " & _ss(1)

Surely you must know the base path to where your target folders are stored.
"Saabster" <cb******@sbcglobal.netwrote in message
news:11**********************@q40g2000cwq.googlegr oups.com...
Actually the double posting was a problem with the beta google groups
interface. for some reason it was hung up and when I trued to refresh
it, it posted twice. I did delete the 2nd erroneous posting as soon as
I saw it. so my apologies for that. I agree I hate seeing multiple
postings as well and usually use a new reader, but as this is a group I
spend little time in, I used Google instead.

Next Thanks for the info on parsing out the serial number. I took a
longer way since I did not know about the split method.

Once I have the target folder name how can find that in a network tree
structure that can be buried 3 levels deep and is not named the serial
number but instead is called "Serial Number 123456-456712"? So I guess
I 'm asking is how do I traverse a directory structure and find a 1
folder out of over 1000 that has my serial number in its name?

Thanks

Craig
Stephany Young wrote:
First of all, if you have an expectation that, when you post a message
via
Google Groups, the message will be 'published' instantly, then please
disabuse yourself of that expectation. Messages can take some minutes to
get
'published'. There is nothing more annoying than people posting messages
multiple times, and even more so when they are only a few seconds apart.

If you want the 'number' part of the filename when all the filenames
conform
to that pattern, all you need to do is something like:

Dim _ss As String() = _filename.Split("#"c")
Dim _targetfolder as String = _ss(1)

The 'number' part will always be found in the 2nd element of the array
returned by the Split method.
"Saabster" <cb******@sbcglobal.netwrote in message
news:11*********************@v33g2000cwv.googlegro ups.com...
Hi all,

I'm fairly new to VB.NET but have more experience with VB6 and earlier.
I'm trying to create an application that will move files from one
folder to another. Here is the scenario.

I have a folder on my local hard drive that has about 1400 .XLS files.
These files are all named with the same pattern of call#_Serial #.xls.
I need to move these to a folder on the network. the network folder
structure is based on serial #. So what I want to do is read through
the files on my local hard drive (particular folder only) then parse
out the serial number from the file name, find that folder on the
network (subfolder of a main folder) and move the file there.

I've built a form that populates a tree control with the files from the
source directory and them I'm stuck on how to proceed from there.

Any help that someone can give me on this would be appreciated.

Thanks

Craig
Jan 4 '07 #5

P: n/a
No VB.NET will not be able to find it, but you will be able to write some
recursive code to walk the directory tree starting from the base path to
find the folder of interest.

For each folder that you inspect that is not the one you want you need to
check it's sub-folders and so on.
"Saabster" <cb******@sbcglobal.netwrote in message
news:11**********************@s80g2000cwa.googlegr oups.com...
>I have the base path mapped as a drive letter so yes I know that, but
the problem is there are subfolders within subfolders. the actual
target folder can be up to 3 levels deeper than the base path.
Will VB.NET beable to find it without having the full path? If so how?

Thanks

Craig
Stephany Young wrote:
>Ahhhh ... Another good reason to avoid Google Groups like the plague :)

Ummm ... How about:

Dim _targetfolder As String = "Serial Number " & _ss(1)

Surely you must know the base path to where your target folders are
stored.
"Saabster" <cb******@sbcglobal.netwrote in message
news:11**********************@q40g2000cwq.googleg roups.com...
Actually the double posting was a problem with the beta google groups
interface. for some reason it was hung up and when I trued to refresh
it, it posted twice. I did delete the 2nd erroneous posting as soon as
I saw it. so my apologies for that. I agree I hate seeing multiple
postings as well and usually use a new reader, but as this is a group I
spend little time in, I used Google instead.

Next Thanks for the info on parsing out the serial number. I took a
longer way since I did not know about the split method.

Once I have the target folder name how can find that in a network tree
structure that can be buried 3 levels deep and is not named the serial
number but instead is called "Serial Number 123456-456712"? So I guess
I 'm asking is how do I traverse a directory structure and find a 1
folder out of over 1000 that has my serial number in its name?

Thanks

Craig
Stephany Young wrote:
First of all, if you have an expectation that, when you post a message
via
Google Groups, the message will be 'published' instantly, then please
disabuse yourself of that expectation. Messages can take some minutes
to
get
'published'. There is nothing more annoying than people posting
messages
multiple times, and even more so when they are only a few seconds
apart.

If you want the 'number' part of the filename when all the filenames
conform
to that pattern, all you need to do is something like:

Dim _ss As String() = _filename.Split("#"c")
Dim _targetfolder as String = _ss(1)

The 'number' part will always be found in the 2nd element of the array
returned by the Split method.
"Saabster" <cb******@sbcglobal.netwrote in message
news:11*********************@v33g2000cwv.googlegr oups.com...
Hi all,

I'm fairly new to VB.NET but have more experience with VB6 and
earlier.
I'm trying to create an application that will move files from one
folder to another. Here is the scenario.

I have a folder on my local hard drive that has about 1400 .XLS
files.
These files are all named with the same pattern of call#_Serial
#.xls.
I need to move these to a folder on the network. the network folder
structure is based on serial #. So what I want to do is read through
the files on my local hard drive (particular folder only) then parse
out the serial number from the file name, find that folder on the
network (subfolder of a main folder) and move the file there.

I've built a form that populates a tree control with the files from
the
source directory and them I'm stuck on how to proceed from there.

Any help that someone can give me on this would be appreciated.

Thanks

Craig


Jan 4 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.