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. Visual Basic
  4. File I/O - Use a data table ?

File I/O - Use a data table ?

Scheduled Pinned Locked Moved Visual Basic
csharpcssdata-structuresjson
3 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.
  • B Offline
    B Offline
    barney_1972
    wrote on last edited by
    #1

    I am a newbie, be gentle. I am starting out with basic File I/O and have seen an example here on 'The Code Project' (TextFileImporter) that uses a data table classto hold the data and then display it in a grid via a dataset. I want to temporarily store the data whilst parsing each line and validating but ultimately don't want to display the data in a grid. Is it common practice to still use a data table in VB.NET or should i use an array or string as in the VB6 style. Thanks Barney

    G 1 Reply Last reply
    0
    • B barney_1972

      I am a newbie, be gentle. I am starting out with basic File I/O and have seen an example here on 'The Code Project' (TextFileImporter) that uses a data table classto hold the data and then display it in a grid via a dataset. I want to temporarily store the data whilst parsing each line and validating but ultimately don't want to display the data in a grid. Is it common practice to still use a data table in VB.NET or should i use an array or string as in the VB6 style. Thanks Barney

      G Offline
      G Offline
      GuyThiebaut
      wrote on last edited by
      #2

      Good question. There are different answers depending on what you want. If you want ease of programming then a datatable is a good choice. This is because it uses rows and columns with which you are probably familiar. If you want speed of processing then I would recommend an arraylist. Arraylists are faster to read and write to, in my experience, than arrays. The catch is that arraylists are not multidimensional. The good news is that there is a way around this problem i.e. how to represent rows and colums in an arraylist. I use arraylists in a csv class I created and they whack the pants off arrays when it comes to processing speed. Alternatively you could use a dataview. What this does is basically make a view of your table. So that it contains the same data. The advantage of a dataview is that you can very easily apply sorts and filters. Also with a dataview all you basically do is point the dataview object to your table et voila you have another way of looking at your datatable. I hope this is of some help to you.:)

      You always pass failure on the way to success.

      B 1 Reply Last reply
      0
      • G GuyThiebaut

        Good question. There are different answers depending on what you want. If you want ease of programming then a datatable is a good choice. This is because it uses rows and columns with which you are probably familiar. If you want speed of processing then I would recommend an arraylist. Arraylists are faster to read and write to, in my experience, than arrays. The catch is that arraylists are not multidimensional. The good news is that there is a way around this problem i.e. how to represent rows and colums in an arraylist. I use arraylists in a csv class I created and they whack the pants off arrays when it comes to processing speed. Alternatively you could use a dataview. What this does is basically make a view of your table. So that it contains the same data. The advantage of a dataview is that you can very easily apply sorts and filters. Also with a dataview all you basically do is point the dataview object to your table et voila you have another way of looking at your datatable. I hope this is of some help to you.:)

        You always pass failure on the way to success.

        B Offline
        B Offline
        barney_1972
        wrote on last edited by
        #3

        Thanks, i think i'll opt for the data table for now then, just to get up and running as i'm only dealing with reasonably small files. For larger files though i'll consider arraylist. Many Thanks:-D

        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