Solved

Visual Studio 2010 - Import CSV data, data mine, show in form for user, then output as text

Posted on 2011-03-19
3
1,251 Views
Last Modified: 2013-12-17
I am looking to grab either a txt, csv, and excel file(whichever would be easier I can get whichever format from the program we are getting it from), import this data in my VS2010 program(windows form or WPF), data mine this to pick out only certain pieces, then display to user, letting them add or edit, then output to a txt file.  What is the best way to do this nowadays?  
0
Comment
Question by:ITSuperman
3 Comments
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 250 total points
Comment Utility
the textfieldparser is an efficient way of parsing a text file: http://emoreau.com/Entries/Articles/2010/05/Do-you-know-the-TextFieldParser.aspx
0
 
LVL 9

Assisted Solution

by:Hawkvalley1
Hawkvalley1 earned 250 total points
Comment Utility
I like to import raw data in a datatable if it's contents are symmetrical (rows and columns). CSV example, but this could be txt as well if comma separated.

Dim dt As New DataTable
'add columns
dt.Columns.Add(<name of column>)
'repeat as needed

Using sr As New StreamReader(<path to file>)
  While Not sr.EndOfStream
     dt.Rows.Add(sr.Readline.Split(","c))
  End While
End Using

Open in new window


Then make LINQ queries to it and display the query. DataGridView are great for displaying datatables.    
 
0
 
LVL 3

Author Comment

by:ITSuperman
Comment Utility
Thanks to you both for your help!  I am working on manipulating the data now into the form.  
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video discusses moving either the default database or any database to a new volume.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now