|
-
Sep 27th, 2003, 12:59 AM
#1
Thread Starter
New Member
How to retrieve Values stored in one Class from another Class
Hi,
I am using Windows Platform to store a series of numbers in a Class called Class1. Then want to retrieve the values from Class1 and experiment in Class2. But am not able to retrieve the values.
I am pasting the code below:-
Code in the windows template ...
This stores a series of values in Class1.
_________________________________________________
Dim Series As New Template.Class1()
With Series
For i = 0 to 100
.Number(i) = i
Next
End With
__________________________________________________
Code in the Template (Class Template) ...
How am i storing the values.
__________________________________________________
Public Class Class1
Private _Number As New Hashtable()
Public Overloads Property Number(ByVal Type As Double) As Double
Get
Return _Number(Type)
End Get
Set(ByVal Value As Double)
_number.Add(Type, Value)
End Set
End Property
End Class
___________________________________________________
A different class for experimenting ...
I want to retrieve the values stored in Number() in a different Class called Class2.
__________________________________________________
Public Class Class2
Inherits Class2
Public Function Experiment()
Experiment = Number(0) + Number(1)
End Function
End Class
___________________________________________________
But it is not retrieving the values.
In the Windows template ...
_________________________________________________
Dim series2 as New Template.Class2()
Msgbox(Series2.Experiment)
_________________________________________________
The answer here is 0 instead of 1.
Thanx in Advance.
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
|