VB Code:
  1. Class Account
  2.         Public Name As String, Number As String
  3.         Sub New(ByVal name As String, ByVal num As String)
  4.             Me.Name = name
  5.             Me.Number = num
  6.         End Sub
  7.     End Class
  8.  
  9.     Class AccountListCollection
  10.         Inherits CollectionBase
  11.         Sub Add(ByVal acct As Account)
  12.             Me.List.Add(acct)
  13.         End Sub
  14.         Sub Remove(ByVal acct As Account)
  15.             Me.List.Remove(acct)
  16.         End Sub
  17.         Default Property item(ByVal index As Integer) As Account
  18.             Get
  19.                 Return DirectCast(Me.List.Item(index), Account)
  20.             End Get
  21.             Set(ByVal Value As Account)
  22.                 Me.List.Item(index) = Value
  23.             End Set
  24.         End Property
  25.     End Class
  26.  
  27.     Private Sub AddAccountbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddAccountbtn.Click
  28.         Dim name, number As String
  29.         Dim newAccount As Account
  30.         With newAccount
  31.             .Name = InputBox("Account Name?")
  32.             .Number = InputBox("Number?")
  33.         End With
  34.     End Sub
  35. End Class
I am trying to add a new account to the list, but don't even know if I am doing it right. The doesn't work anyway.

kevin