I understand how to access a file with the StreamReader, but only with ReadLine(). How do I seperate that line into the three separate sections that are seperated by commas?
You could use the Split method of the string to split it into an array.
Code:
Dim sToSplit As String String to split up
Dim sParts() As String Comma-separated parts of the string
Get sToSplit here by reading a line from the stream
sParts = sToSplit.Split(",")
The array item sParts(0) will be the first part, sParts(1) the
second, and sParts(2) the third.
Dim strName() As String, tempString As String, i As Integer
tempString = "Testing,out,explicit,type,casting"
strName = tempString.Split(","c)
For i = strName.GetLowerBound(0) To strName.GetUpperBound(0)
lstDetails.Items.Add(strName(i))
Next
And what is the easiest way to strip off the double quotes with Option Strict is on? The file has the first set of data in double quotes and if I try to Trim it is says it cant handle the double quote char within a string!
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.