How to return array of object

G

Guest

hi i need to send some data to the function and want to return array of object bac
lik

dim obj() as myclass=AddIt(i,j
i dont know that is write syntax or no

public function addit(byval i as interger, byval j as integer) as myclas
dim obj(20) as myclas
obj(0).additem( i,j
obj(1).additem(i,j
 
H

Herfried K. Wagner [MVP]

* =?Utf-8?B?QWxp?= said:
hi i need to send some data to the function and want to return array of object back
like

dim obj() as myclass=AddIt(i,j)
i dont know that is write syntax or not

public function addit(byval i as interger, byval j as integer) as
myclass

'... As MyClass()'.
dim obj(20) as myclass
obj(0).additem( i,j)
obj(1).additem(i,j)
.
.
obj(20).additem(i,j)

'obj(i) = ...'.
 
P

Poolbeer \(MCP\)

You should add parenthesis to the return object...
Syntax sample below

Your implmentation of AddIt
public function addit(byval i as interger, byval j as integer) as myclass

Corrected AddIt
Public Function AddIt(ByVal i As Integer, ByVal j As Integer) as myClass()

Hope it helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top