473,395 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Reading in .csv files

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
2 10903
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Olivier Maurice | last post by:
Hi all, I suppose some of you know the program Redmon (type redmon in google, first result). This neat little tool allows to hook up any functionality to a printer by putting the file printed...
19
by: Lionel B | last post by:
Greetings, I need to read (unformatted text) from stdin up to EOF into a char buffer; of course I cannot allocate my buffer until I know how much text is available, and I do not know how much...
1
by: Magnus | last post by:
allrite folks, got some questions here... 1) LAY-OUT OF REPORTS How is it possible to fundamentaly change the lay-out/form of a report in access? I dont really know it that "difficult", but...
6
by: Rajorshi Biswas | last post by:
Hi folks, Suppose I have a large (1 GB) text file which I want to read in reverse. The number of characters I want to read at a time is insignificant. I'm confused as to how best to do it. Upon...
2
by: nnimod | last post by:
Hi. I'm having trouble reading some unicode files. Basically, I have to parse certain files. Some of those files are being input in Japanese, Chinese etc. The easiest way, I figured, to distinguish...
7
by: jccorreu | last post by:
I've got to read info from multiple files that will be given to me. I know the format and what the data is. The thing is each time we run the program we may be using a differnt number of files,...
6
by: arne.muller | last post by:
Hello, I've come across some problems reading strucutres from binary files. Basically I've some strutures typedef struct { int i; double x; int n; double *mz;
10
by: Tyler | last post by:
Hello All: After trying to find an open source alternative to Matlab (or IDL), I am currently getting acquainted with Python and, in particular SciPy, NumPy, and Matplotlib. While I await the...
5
blazedaces
by: blazedaces | last post by:
Ok, so you know my problem, java is running out of memory reading with SAX, the event-based xml parser intended more-so than DOM for extremely large files. I'll try to explain what I've been doing...
4
by: Miner Jeff | last post by:
Hello, I have a basic question about reading files. I have several data files where the filenames are identical except for a short (3 character) prefix. I inherited this code and the person who...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.