|
-
February 28th, 2006, 02:33 PM
#1
Passing array's in classes....
Ok, here goes: what i'm trying to do is create my first class, then in my second class create an array of that instance. Here is my code:
Code:
Class transaction
Private m_name, m_todayDate As String
Private m_amount, m_change As Double
Public Property name() As String
Get
Return m_name
End Get
Set(ByVal Value1 As String)
m_name = Value1
End Set
End Property
Public Property amount() As Double
Get
Return m_amount
End Get
Set(ByVal Value2 As Double)
m_amount = Value2
End Set
End Property
Public Property todayDate() As String
Get
Return m_todayDate
End Get
Set(ByVal Value3 As String)
m_todayDate = Value3
End Set
End Property
Public Property change() As Double
Get
Return m_change
End Get
Set(ByVal Value4 As Double)
m_change = Value4
End Set
End Property
End Class
Public Class account
Public checking As transaction()
Public savings As transaction()
Public saveBal As Double
Public checkBal As Double
End Class
then...
check = New account
check.checking(1).name = "Hello"
lstTrans.Items.Add(check.checking(1).name)
this will give me an Object reference not set to an instance of an object error. Any ideas???? Thanks!
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
|