Public Class Form1
    Inherits System.Windows.Forms.Form

    ' enum...
    Public Enum PersonDataIndex As Integer
        Name = 0
        Email = 1
        Sex = 2
    End Enum



#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
    Friend WithEvents lstFriends As System.Windows.Forms.ListBox
    Friend WithEvents btnGo As System.Windows.Forms.Button

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.Container

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.btnGo = New System.Windows.Forms.Button()
        Me.lstFriends = New System.Windows.Forms.ListBox()
        Me.SuspendLayout()
        '
        'btnGo
        '
        Me.btnGo.Location = New System.Drawing.Point(272, 16)
        Me.btnGo.Name = "btnGo"
        Me.btnGo.Size = New System.Drawing.Size(96, 24)
        Me.btnGo.TabIndex = 1
        Me.btnGo.Text = "Go"
        '
        'lstFriends
        '
        Me.lstFriends.IntegralHeight = False
        Me.lstFriends.Location = New System.Drawing.Point(8, 16)
        Me.lstFriends.Name = "lstFriends"
        Me.lstFriends.Size = New System.Drawing.Size(248, 104)
        Me.lstFriends.TabIndex = 0
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(384, 133)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnGo, Me.lstFriends})
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub btnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGo.Click

        ' define an array to hold friends in...
        Dim friends(2, 2) As String

        ' set the data...
        friends(0, PersonDataIndex.Name) = "Darren"
        friends(0, PersonDataIndex.Email) = "darren@pretendcompany.com"
        friends(0, PersonDataIndex.Sex) = "M"

        friends(1, PersonDataIndex.Name) = "Edward"
        friends(1, PersonDataIndex.Email) = "edward@pretendcompany.com"
        friends(1, PersonDataIndex.Sex) = "M"

        friends(2, PersonDataIndex.Name) = "Len"
        friends(2, PersonDataIndex.Email) = "len@pretendcompany.com"
        friends(2, PersonDataIndex.Sex) = "F"



        ' show the friends...
        AddFriendsToList(friends)



    End Sub

    Sub AddFriendsToList(ByVal friends(,) As String)

        ' add each friend...
        Dim row As Integer
        For row = 0 To UBound(friends, 1)

            ' we'll need a string...
            Dim buf As String = ""

            ' go through each part...
            Dim column As Integer
            For column = 0 To UBound(friends, 2)

                ' add it...
                buf &= friends(row, column) & ", "

            Next

            ' add the string...
            lstFriends.Items.Add(buf)

        Next


    End Sub




End Class
