Help Needed with Treeview control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Saabster

    #1

    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

  • Stephany Young

    #2
    Re: Help Needed with Treeview control

    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" <cbobchin@sbcgl obal.netwrote in message
    news:1167870704 .903216.57500@v 33g2000cwv.goog legroups.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
    >

    Comment

    • Saabster

      #3
      Re: Help Needed with Treeview control

      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" <cbobchin@sbcgl obal.netwrote in message
      news:1167870704 .903216.57500@v 33g2000cwv.goog legroups.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

      Comment

      • Stephany Young

        #4
        Re: Help Needed with Treeview control

        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" <cbobchin@sbcgl obal.netwrote in message
        news:1167874622 .239799.271430@ q40g2000cwq.goo glegroups.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" <cbobchin@sbcgl obal.netwrote in message
        >news:116787070 4.903216.57500@ v33g2000cwv.goo glegroups.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
        >
        >

        Comment

        • Saabster

          #5
          Re: Help Needed with Treeview control

          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" <cbobchin@sbcgl obal.netwrote in message
          news:1167874622 .239799.271430@ q40g2000cwq.goo glegroups.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" <cbobchin@sbcgl obal.netwrote in message
          news:1167870704 .903216.57500@v 33g2000cwv.goog legroups.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

          Comment

          • Stephany Young

            #6
            Re: Help Needed with Treeview control

            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" <cbobchin@sbcgl obal.netwrote in message
            news:1167931631 .224952.256060@ s80g2000cwa.goo glegroups.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" <cbobchin@sbcgl obal.netwrote in message
            >news:116787462 2.239799.271430 @q40g2000cwq.go oglegroups.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" <cbobchin@sbcgl obal.netwrote in message
            >news:116787070 4.903216.57500@ v33g2000cwv.goo glegroups.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
            >
            >
            >

            Comment

            Working...