Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Splitting an ArrayList

Splitting an ArrayList

Scheduled Pinned Locked Moved C#
csshelptutorialquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    scotlandc
    wrote on last edited by
    #1

    Hi, I have an ArrayList which was populated by a text file with no column headers. What I want to do is split the ArrayList into columns then display it in a datagrid. The ArrayList is made up of lines such as 0168EH1X.PA0 020 1 GRA_ 08/14/06 12:16:42 I need to split this into 5 columns under the headings ID, Duration, Status, Channel and DateTime. I've been trying to do this with the .SubString method but no luck. I know how to define the columns in the grid but I can't split the ArrayList up. Please can anyone help? Thanks Scott

    N 1 Reply Last reply
    0
    • S scotlandc

      Hi, I have an ArrayList which was populated by a text file with no column headers. What I want to do is split the ArrayList into columns then display it in a datagrid. The ArrayList is made up of lines such as 0168EH1X.PA0 020 1 GRA_ 08/14/06 12:16:42 I need to split this into 5 columns under the headings ID, Duration, Status, Channel and DateTime. I've been trying to do this with the .SubString method but no luck. I know how to define the columns in the grid but I can't split the ArrayList up. Please can anyone help? Thanks Scott

      N Offline
      N Offline
      Nader Elshehabi
      wrote on last edited by
      #2

      Hello Is your ArrayList an array of strings each on the above format?

      Regards:rose:

      S 1 Reply Last reply
      0
      • N Nader Elshehabi

        Hello Is your ArrayList an array of strings each on the above format?

        Regards:rose:

        S Offline
        S Offline
        scotlandc
        wrote on last edited by
        #3

        Hi, Yes, it is. Anywhere between 10 and 150 strings. The format for each string is identical.

        N 1 Reply Last reply
        0
        • S scotlandc

          Hi, Yes, it is. Anywhere between 10 and 150 strings. The format for each string is identical.

          N Offline
          N Offline
          Nader Elshehabi
          wrote on last edited by
          #4

          scotlandc wrote:

          0168EH1X.PA0 020 1 GRA_ 08/14/06 12:16:42 I need to split this into 5 columns under the headings ID, Duration, Status, Channel and DateTime.

          Simple! use

          MyArrayList[X].ToString().Split(' ');

          to get an array of strings of each column.

          Regards:rose:

          S 1 Reply Last reply
          0
          • N Nader Elshehabi

            scotlandc wrote:

            0168EH1X.PA0 020 1 GRA_ 08/14/06 12:16:42 I need to split this into 5 columns under the headings ID, Duration, Status, Channel and DateTime.

            Simple! use

            MyArrayList[X].ToString().Split(' ');

            to get an array of strings of each column.

            Regards:rose:

            S Offline
            S Offline
            scotlandc
            wrote on last edited by
            #5

            Thank you very much, will give it a go.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups