Hello all, im new here to please bear with me on this. Im pretty new to vb.net as well with little to almost no experience in vb syntax. Scripting i do alright with though.
Ive been googling all day and havent found anything helpful there or at bing/yahoo etc and my problem is this.
i have a csv file that has 3 columns from my database in it and it looks like this even with the blank row between them.
and my source looks like
This works fine an dandy for dumping each field, delimited by the comma, and it displays all the information in a text box. However, i need column 2 ONLY. Can anybody help me out? i also searched on here and the closest thing i found was
but its still not quite what im after.
Thank you for reading
Ive been googling all day and havent found anything helpful there or at bing/yahoo etc and my problem is this.
i have a csv file that has 3 columns from my database in it and it looks like this even with the blank row between them.
VB.NET:
"column1","column2","column3"
"column1","column2","column3"
"column1","column2","column3"
and my source looks like
VB.NET:
Public Sub parser()
SyncLock locker
Dim accts As String
Dim currentfield As String
accts = TextBox1.Text
Using myreader As New Microsoft.VisualBasic.FileIO.TextFieldParser(accts)
myreader.TextFieldType = FileIO.FieldType.Delimited
myreader.Delimiters = New String() {",", "\n"}
Dim currentrow As String()
While Not myreader.EndOfData
Try
currentrow = myreader.ReadFields()
For Each currentfield In currentrow
MsgBox(currentfield)
Next
Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
MsgBox("Line " & ex.Message & "invalid - skipped")
End Try
End While
End Using
End SyncLock
End Sub
This works fine an dandy for dumping each field, delimited by the comma, and it displays all the information in a text box. However, i need column 2 ONLY. Can anybody help me out? i also searched on here and the closest thing i found was
VB.NET:
http://www.vbdotnetforums.com/vb-net-general-discussion/42590-parsing-csv-file.html
Thank you for reading