473,394 Members | 1,645 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,394 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 1494
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: 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
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:
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.