473,405 Members | 2,262 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,405 software developers and data experts.

Building an array from a csv txt file

Help, went brain dead here, need to build a multi dem array from a csv txt
file, just point to a good article and I am sure the old gray matter will do
a doh!.
Jul 21 '05 #1
10 1495
James,

Building an array(list) is some work because you would have to make objects
and a loop, making a dataset is a piece of cake.

Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim file As String = "Test2.txt"
Dim path As String = "C:\Test1\"
Dim ds As New DataSet
Try
Dim f As System.IO.File
If f.Exists(path & file) Then
Dim ConStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
path & ";Extended Properties=""Text;HDR=No;FMT=Delimited\"""
Dim conn As New OleDb.OleDbConnection(ConStr)
Dim da As New OleDb.OleDbDataAdapter("Select * from " & _
file, conn)
da.Fill(ds, "TextFile")
End If
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
DataGrid1.DataSource = ds.Tables(0)
End Sub
///

I hope this helps?

Cor
Jul 21 '05 #2
James,

Building an array(list) is some work because you would have to make objects
and a loop, making a dataset is a piece of cake.

Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim file As String = "Test2.txt"
Dim path As String = "C:\Test1\"
Dim ds As New DataSet
Try
Dim f As System.IO.File
If f.Exists(path & file) Then
Dim ConStr As String = _
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
path & ";Extended Properties=""Text;HDR=No;FMT=Delimited\"""
Dim conn As New OleDb.OleDbConnection(ConStr)
Dim da As New OleDb.OleDbDataAdapter("Select * from " & _
file, conn)
da.Fill(ds, "TextFile")
End If
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try
DataGrid1.DataSource = ds.Tables(0)
End Sub
///

I hope this helps?

Cor
Jul 21 '05 #3
guy
Dump the file into a string and then use Split to build your array

hth guy

"James D. Marshall" wrote:
Help, went brain dead here, need to build a multi dem array from a csv txt
file, just point to a good article and I am sure the old gray matter will do
a doh!.

Jul 21 '05 #4
guy
Dump the file into a string and then use Split to build your array

hth guy

"James D. Marshall" wrote:
Help, went brain dead here, need to build a multi dem array from a csv txt
file, just point to a good article and I am sure the old gray matter will do
a doh!.

Jul 21 '05 #5
Thanks, got them to dump it to an access database instead, I WIN.....I
think....lol
"James D. Marshall" <cr**********@hotmail.com> wrote in message
news:4gG8d.418737$8_6.257209@attbi_s04...
Help, went brain dead here, need to build a multi dem array from a csv txt
file, just point to a good article and I am sure the old gray matter will
do a doh!.

Jul 21 '05 #6
And why not the sample I provided?
Thanks, got them to dump it to an access database instead, I WIN.....I
think....lol
"James D. Marshall"

Jul 21 '05 #7
Cor;
The issue is a control issue from another person, sometimes you just
have to drag a person screaming and yelling into the 20th century, much less
getting them into the 21st. Your answer was does provide a means to work
around the current situation, so please do not become offended. I have been
dealing with this much longer than is necessary.

"Cor Ligthert" <no************@planet.nl> wrote in message
news:OL**************@TK2MSFTNGP15.phx.gbl...
And why not the sample I provided?
Thanks, got them to dump it to an access database instead, I WIN.....I
think....lol
"James D. Marshall"


Jul 21 '05 #8
I do not know what this has to do with offended, what I do not understand is
why you do not take that standard solution for this problem. And than I am
curious for your workaround. Dumping an excel sheet in an access database
(whatever you mean with that) is not an answer on your original question.
The issue is a control issue from another person, sometimes you just
have to drag a person screaming and yelling into the 20th century, much
less getting them into the 21st. Your answer was does provide a means to
work around the current situation, so please do not become offended. I
have been dealing with this much longer than is necessary.

"Cor Ligthert"

...
And why not the sample I provided?
Thanks, got them to dump it to an access database instead, I WIN.....I
think....lol
"James D. Marshall"



Jul 21 '05 #9
Flame warz... don't you just love 'em ;-)
"Cor Ligthert" <no************@planet.nl> wrote in message
news:uE**************@tk2msftngp13.phx.gbl...
I do not know what this has to do with offended, what I do not understand
is why you do not take that standard solution for this problem. And than I
am curious for your workaround. Dumping an excel sheet in an access
database (whatever you mean with that) is not an answer on your original
question.
The issue is a control issue from another person, sometimes you just
have to drag a person screaming and yelling into the 20th century, much
less getting them into the 21st. Your answer was does provide a means to
work around the current situation, so please do not become offended. I
have been dealing with this much longer than is necessary.

"Cor Ligthert"

..
And why not the sample I provided?

Thanks, got them to dump it to an access database instead, I WIN.....I
think....lol
"James D. Marshall"



Jul 21 '05 #10
Okay hon,
You did provide (a) solution. In any future replies to questions, one
would hope and pray that you are able to get over yourself!
"Cor Ligthert" <no************@planet.nl> wrote in message
news:uE**************@tk2msftngp13.phx.gbl...
I do not know what this has to do with offended, what I do not understand
is why you do not take that standard solution for this problem. And than I
am curious for your workaround. Dumping an excel sheet in an access
database (whatever you mean with that) is not an answer on your original
question.
The issue is a control issue from another person, sometimes you just
have to drag a person screaming and yelling into the 20th century, much
less getting them into the 21st. Your answer was does provide a means to
work around the current situation, so please do not become offended. I
have been dealing with this much longer than is necessary.

"Cor Ligthert"

..
And why not the sample I provided?

Thanks, got them to dump it to an access database instead, I WIN.....I
think....lol
"James D. Marshall"



Jul 21 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: brian | last post by:
Hello, I have spen hours trying to find information on dynamically building a table from an array. What I need: I have an array pulling file paths from a directory using a For Next Loop. F is...
6
by: Dennis | last post by:
I was trying to determine the fastest way to build a byte array from components where the size of the individual components varied depending on the user's input. I tried three classes I built: (1)...
10
by: James D. Marshall | last post by:
Help, went brain dead here, need to build a multi dem array from a csv txt file, just point to a good article and I am sure the old gray matter will do a doh!.
1
by: lennyw | last post by:
Hi I'm trying to build XMLgawk (latest version 3.1.5 from sourceforge) and I'm getting some make errors. I'm using the tool availbale from Cygwin to do the build (gcc, bash, make). I was able...
6
by: Yi Xing | last post by:
Hi, I need to read specific lines of huge text files. Each time, I know exactly which line(s) I want to read. readlines() or readline() in a loop is just too slow. Since different lines have...
2
by: lawpoop | last post by:
Hello folks - I'm working on a function to map a php project that's gotten a little unwieldly. I'd like to have a reference of all files like the output of the unix tree command, like this: .....
1
by: sarahdiginets | last post by:
Hi all, can anyone here help me building my array? if so , how can i send the file regards sarah
1
by: dileepd | last post by:
Hi Every one, Could you please let me know if you have any clue about following things. 1. Whether type bool acts like a kind of signed int type in g++ on solaris 9(a/c to my invetsigation it...
7
Curtis Rutland
by: Curtis Rutland | last post by:
Building A Silverlight (2.0) Multi-File Uploader All source code is C#. VB.NET source is coming soon. Note: This project requires Visual Studio 2008 SP1 or Visual Web Developer 2008 SP1 and...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.