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,253 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
ID: 35172628
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
ID: 35173260
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
ID: 35173965
Thanks to you both for your help!  I am working on manipulating the data now into the form.  
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Server Error 11 47
Vb. Net application freezes 9 27
Handle KeyDown for ToolStripDropDownButton, ToolStripMenuItem 3 17
Access to class from any project within a solution. 6 14
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

929 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

9 Experts available now in Live!

Get 1:1 Help Now