By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,918 Members | 1,520 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,918 IT Pros & Developers. It's quick & easy.

Reading in .csv files

P: n/a
Hi, i am new to VB.Net and really enjoying the trip so far =)

However I have this problem:
I was wondering if anyone is familiar with how to go about reading in an
Excel ".csv" file? I had a search on the internet and found some VB6 code
examples, but i don't think VB6 code is the same as VB.Net is it?

I basically need to read the file in, storing the data (which is arranged in
columns) into a 2Dimensional array.
From there i want to write that data to a database table (most likely
Access) for permanent storage. Any future oeprations on the data (such as
search, edit) will reference the database table i wrote to.

I am familiar with using things like a StringTokenizer in Java, loops and
reading file in, but what do we have available in VB.Net? And should i take
note of the VB6 examples i found or start from scratch?
Any help or reference links is greatly appreciated!

Regards
Nick Hoare
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Nick,
The closest thing to StringTokenizer in .NET is String.Split.

There are actually three Split functions in VB.NET:

Use Microsoft.VisualBasic.Strings.Split if you need to split a string based
on a specific word (string). It is the Split function from VB6.

Use System.String.Split if you need to split a string based on a collection
of specific characters. Each individual character is its own delimiter.

Alternatively use System.Text.RegularExpressions.RegEx.Split to split based
on matching patterns.

Hope this helps
Jay
"Nick Hoare" <ho*********@hotmail.com> wrote in message
news:tQ*******************@news-server.bigpond.net.au...
Hi, i am new to VB.Net and really enjoying the trip so far =)

However I have this problem:
I was wondering if anyone is familiar with how to go about reading in an
Excel ".csv" file? I had a search on the internet and found some VB6 code
examples, but i don't think VB6 code is the same as VB.Net is it?

I basically need to read the file in, storing the data (which is arranged in columns) into a 2Dimensional array.
From there i want to write that data to a database table (most likely
Access) for permanent storage. Any future oeprations on the data (such as
search, edit) will reference the database table i wrote to.

I am familiar with using things like a StringTokenizer in Java, loops and
reading file in, but what do we have available in VB.Net? And should i take note of the VB6 examples i found or start from scratch?
Any help or reference links is greatly appreciated!

Regards
Nick Hoare

Jul 19 '05 #2

P: n/a
Hi Nick,

Can you save the data in the excel file as XML, if you can you can read it
directly into a data adapter using the ReadXML function.

Cheers
Andrew
"Nick Hoare" <ho*********@hotmail.com> wrote in message
news:tQ*******************@news-server.bigpond.net.au...
Hi, i am new to VB.Net and really enjoying the trip so far =)

However I have this problem:
I was wondering if anyone is familiar with how to go about reading in an
Excel ".csv" file? I had a search on the internet and found some VB6 code
examples, but i don't think VB6 code is the same as VB.Net is it?

I basically need to read the file in, storing the data (which is arranged in columns) into a 2Dimensional array.
From there i want to write that data to a database table (most likely
Access) for permanent storage. Any future oeprations on the data (such as
search, edit) will reference the database table i wrote to.

I am familiar with using things like a StringTokenizer in Java, loops and
reading file in, but what do we have available in VB.Net? And should i take note of the VB6 examples i found or start from scratch?
Any help or reference links is greatly appreciated!

Regards
Nick Hoare

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.