|
-
Jan 16th, 2005, 01:10 PM
#1
Class and collections
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
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
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
-
Jan 16th, 2005, 02:11 PM
#2
Addicted Member
Re: Class and collections
VB Code:
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 New Account(InputBox("Account Name?"), InputBox("Number?"))
Dim newAccountListCollection as new AccountListCollection
newAccountListCollection.Add(newAccount)
End Sub
-
Jan 16th, 2005, 02:42 PM
#3
Re: Class and collections
thanks
kevin
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|