.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

return function with multiple objects

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
wbdehaan
484 Views, 2 Replies

return function with multiple objects

Hi, 

 

I would like to return multiple objects from a function. can it be done? and how?

 

function DrawLines()as object

objline1 as new line

objline2 as new line

[..]

 

return 'objects'

end function

 

sub Main

Dim Group1 as new Arraylist

Group1.Add(DrawLines())

end sub

 

 

kind regards Wouter

 

 

 

2 REPLIES 2
Message 2 of 3

Hello!

 

I think the simplyest way to do it is to return an array of lines (or entityes) from your function:

 

Function DrawLines()as line()

   Dim ArOut() As line

   [···]

   Rerutn ArOut

End Function

 

But you may also return a "collection", a "list (Of line)" or another thing...

 

Hope this helps!

Luis Alberto Manero, Geograma.com
Message 3 of 3
wbdehaan
in reply to: wbdehaan

Thanx a lot!

it helped, and i created now an arraylist to return the objects:

 

 

 

    Public Function Drawlines() As ArrayList
        Dim ObjLijn1 As New Line
        Dim ObjLijn2 As New Line
        Dim Lijst As New ArrayList
        ObjLijn1.StartPoint = New Point3d(CenterX + F1, CenterY + Grootte / 2, 0)
        ObjLijn1.EndPoint = New Point3d(CenterX - F1, CenterY - Grootte / 2, 0)
        Lijst.Add(ObjLijn1)
        ObjLijn2.StartPoint = New Point3d(CenterX - Grootte / 2, CenterY + F1, 0)
        ObjLijn2.EndPoint = New Point3d(CenterX + Grootte / 2, CenterY - F1, 0)
        Lijst.Add(ObjLijn2)
        '---Return lijst
        Return Lijst
    End Function

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Autodesk Design & Make Report