2
votes

This is the code in Visual Basic. I found it on the web and changed some minor things. But what does the 20 do there? How do I know what number to place there?

Dim rowvalue As String
Dim cellvalue(20) As String 
Dim streamReader As IO.StreamReader = New IO.StreamReader("test.txt", System.Text.Encoding.Default)
While streamReader.Peek() <> -1
    rowvalue = streamReader.ReadLine()
    cellvalue = rowvalue.Split("|"c)
    If Not rowvalue = "" Then
        Database1DataSet.entries.Rows.Add(cellvalue)
    End If
End While
2

2 Answers

2
votes

That is an array, which is a list of values. That array is declared to hold up to 20 strings.

You can access each item in the list by cellvalue(1), cellvalue(2), and so on up to cellvalue(20).

1
votes
Dim cellvalue(20) As String

The above code declares a string array that is exactly 20 items long.