VB.NET String Array
How can I build an array of strings using VB.NET?
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
FroglegRank #1,020 · 1.9K reputationPosted Mar 20, 2011, 2:10 PM EDT
str(0)= ("Big")
str(1) = ("dog")
str(2) = ("bites")
Arrays start at zero
Karthikeyan AnbarasanRank #71 · 25.5K reputationPosted Apr 8, 2011, 12:38 AM EDT
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
FroglegRank #1,020 · 1.9K reputationPosted Apr 8, 2011, 1:31 AM EDT
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