Tony Dinozzo
Tony Dinozzo

Reputation: 21

What does "cellvalue(20)" mean here?

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

Upvotes: 2

Views: 48

Answers (2)

dinomix
dinomix

Reputation: 976

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).

Upvotes: 1

Joshua Dannemann
Joshua Dannemann

Reputation: 2080

Dim cellvalue(20) As String

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

Upvotes: 2

Related Questions