Building an array from a csv txt file

  • Thread starter Thread starter James D. Marshall
  • Start date Start date
J

James D. Marshall

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!.
 
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
 
Thanks, got them to dump it to an access database instead, I WIN.....I
think....lol
 
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.
 
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.
 
Flame warz... don't you just love 'em ;-)


Cor Ligthert said:
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.
 
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!
 
Back
Top