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.VB Code:
Class Account Public Name As String, Number As String Sub New(ByVal name As String, ByVal num As String) Me.Name = name Me.Number = num End Sub End Class Class AccountListCollection Inherits CollectionBase Sub Add(ByVal acct As Account) Me.List.Add(acct) End Sub Sub Remove(ByVal acct As Account) Me.List.Remove(acct) End Sub Default Property item(ByVal index As Integer) As Account Get Return DirectCast(Me.List.Item(index), Account) End Get Set(ByVal Value As Account) Me.List.Item(index) = Value End Set End Property End Class Private Sub AddAccountbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddAccountbtn.Click Dim name, number As String Dim newAccount As Account With newAccount .Name = InputBox("Account Name?") .Number = InputBox("Number?") End With End Sub End Class
![]()
![]()
kevin




Reply With Quote