473,387 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Help Needed with Treeview control

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
5 1508
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: MSNEWS | last post by:
Hi I'm trying to use the treeview control but having a hard time trying to visualize how I'm going to achieve when I'm trying to do, as an example in the end of my program I want my treeview to...
12
by: serge calderara | last post by:
Dear all, I have a function that I need to run in a thread due to the fact that it can takes long time to execute according to the amount of data to collect. This function is also populating a...
0
by: timtos | last post by:
I want to write my own treeview control. I set this.SetStyle(ControlStyles.UserPaint, true); and painted a treeview from scratch. So far so good. The problem now is that if I use/ tear the...
10
by: Brian | last post by:
I'm reasonably new to C#, and using a class containing a hashtable collection to feed a treeview. My problem is that I can't pull the data from the hashtable! Here's the code I have: if...
1
by: needin4mation | last post by:
Hi, I am using C# in asp.net. I have my treeview control from my built ..dll on my toolbox. I can drop it on the webpage. What I cannot do is reference treeview objects from the codebehind form....
8
by: RCS | last post by:
All, OK, so I'm working on a template for our new ASP.NET applications. Part of this, includes using the new menu and breadcrumbs control in ASP.NET 2.0 (I'm using beta 2). I put the...
2
by: pmcguire67 | last post by:
There has been a lot of discussion lately about extending the treeview control to allow finding a node by key rather than by index. Everyone seems to agree that a hashtable is needed to accomplish...
3
by: ljh | last post by:
Just learning......so please be gentle.... This is the idea (wrong as it may be)....... I'd like to code an app that has a treeview for a navigation element that opens panels (to it's right)...
1
by: Blue Apricot | last post by:
Hello friendly people, I am on Day 2 of learniing ASP.NET. I am bored with watching videos, and want to "do something". In my current role as a Front End Designer making User Interfaces, I...
32
by: =?Utf-8?B?U2l2?= | last post by:
I have a form that I programmatically generate some check boxes and labels on. Later on when I want to draw the form with different data I want to clear the previously created items and then put...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.