Farshid
Aug 16th, 2001, 10:44 PM
Hi friends.
Recently i am working on a program which requires me to do some conversion from Java to Visual Basic. The area where i am facing problem is the object oriented programming part of visual basic. the problem is here:
I have a class named IntegerArray. It has the following methods:
1. Class_Int(size as long) 'Initialization
2 AddItem(item as Variant) 'Adding an item to array
3. SetItem(index as Long, item as Variant) ' Setting an item
4. LastItem() 'gives the last item
5. FirstItem() 'gives the first item
6. noItem() 'returns the number of items
The idea of IntegerArray class is like the Vector class in Java. It is actually an array to hold any type of data types and increase its size as the array is filled to its upper bound.
The problem arrises here:
Dim MainArray as IntegerArray
MainArray.Class_Int 10 'initializing an array of size 10
'Here i declare another array of type IntegerArray
Dim Array1 as IntegerArray
Dim Array2 as IntegerArray
Array1.Class_Int(10)
Array2.Class_Int(10)
'Here is where i get error when i want to store Array1 and Array2 in MainArray.
MainArray.AddItem Array1
MainArray.AddItem Array2
Here it gives me error and says that i cannot store Array1 and Array2 in the MainArray...
Hope you understood my problem. Please help me as i need to rectify this bug soon... mail me at webkiddie@yahoo.com if you need the source code for the class.
Waiting for your responses...
Thanks...
Farshid
Recently i am working on a program which requires me to do some conversion from Java to Visual Basic. The area where i am facing problem is the object oriented programming part of visual basic. the problem is here:
I have a class named IntegerArray. It has the following methods:
1. Class_Int(size as long) 'Initialization
2 AddItem(item as Variant) 'Adding an item to array
3. SetItem(index as Long, item as Variant) ' Setting an item
4. LastItem() 'gives the last item
5. FirstItem() 'gives the first item
6. noItem() 'returns the number of items
The idea of IntegerArray class is like the Vector class in Java. It is actually an array to hold any type of data types and increase its size as the array is filled to its upper bound.
The problem arrises here:
Dim MainArray as IntegerArray
MainArray.Class_Int 10 'initializing an array of size 10
'Here i declare another array of type IntegerArray
Dim Array1 as IntegerArray
Dim Array2 as IntegerArray
Array1.Class_Int(10)
Array2.Class_Int(10)
'Here is where i get error when i want to store Array1 and Array2 in MainArray.
MainArray.AddItem Array1
MainArray.AddItem Array2
Here it gives me error and says that i cannot store Array1 and Array2 in the MainArray...
Hope you understood my problem. Please help me as i need to rectify this bug soon... mail me at webkiddie@yahoo.com if you need the source code for the class.
Waiting for your responses...
Thanks...
Farshid