Tuesday 24 July 2012

Array in vb.net

In this tutorial, we cover the Array in Visual Basic .NET. Like the variable, arrays will seem pretty useless to you right now but will prove very useful to you in the future. We will first create an array and then loop through it using the for loop that we covered in a previous tutorial.

Copy and paste below Code:

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim tvshows(4) As String
        tvshows(0) = "South Park"
        tvshows(1) = "Family Guy"
        tvshows(2) = "American Dad"
        tvshows(3) = "The Simpsons"
        tvshows(4) = "Supernatural"

        For i = 0 To tvshows.Length - 1

            MessageBox.Show(tvshows(i))

        Next
    End Sub

End Class

No comments:

Post a Comment