VB.NET String Array
How can I build an array of strings using VB.NET?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
FroglegPosted Apr 8, 2011, 5:31 AM
Dim sport(5) As String
'declaring an array
sport(0) = "Soccer"
sport(1) = "Cricket"
sport(2) = "Rugby"
sport(3) = "Aussie Rules"
sport(4) = "BasketBall"
sport(5) = "Hockey"
should be
Dim sport(6) As String
'declaring an array
sport(0) = "Soccer" 1
sport(1) = "Cricket" 2
sport(2) = "Rugby" 3
sport(3) = "Aussie Rules" 4
sport(4) = "BasketBall" 5
sport(5) = "Hockey" 6
Karthikeyan AnbarasanPosted Apr 8, 2011, 4:38 AM
Imports System.Console
Module Module1
Sub Main()
Dim sport(5) As String
'declaring an array
sport(0) = "Soccer"
sport(1) = "Cricket"
sport(2) = "Rugby"
sport(3) = "Aussie Rules"
sport(4) = "BasketBall"
sport(5) = "Hockey"
'storing values in the array
WriteLine("Name of the Sport in the third location" & " " & sport(2))
'displaying value from array
End Sub
End Module
FroglegPosted Mar 20, 2011, 6:10 PM
str(0)= ("Big")
str(1) = ("dog")
str(2) = ("bites")
Arrays start at zero