Wednesday, 22 June 2011

Football Team

Public Class Form1

    Dim player(50, 1) As String
    Dim arrayrow As Integer

    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        If txtName.Text = "" Or txtNumber.Text = "" Then
            MsgBox("Please enter NAME and NUMBER")
        Else
            player(arrayrow, 0) = txtName.Text
            player(arrayrow, 1) = txtNumber.Text
            txtName.Text = ""
            txtNumber.Text = ""
            arrayrow = arrayrow + 1
            txtName.Focus()
        End If
    End Sub

    Private Sub btnShowTeam_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShowTeam.Click
        arrayrow = 0
        For arrayrow As Integer = 0 To 50
            If Not player(arrayrow, 0) = "" Then
                lstTeam.Items.Add(player(arrayrow, 0) & " | " & player(arrayrow, 1))
            End If
        Next
    End Sub
End Class