borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Drag and Drop and Detection)Next Topic (VB.NET 2005 MsgBox Problems) New Topic New Poll Post Reply
AndreaVB Forum : VB.Net : Class with an array of another class in it
Poster Message
jtaylor42
Level: Graduate

Registered: 20-10-2005
Posts: 10

icon Class with an array of another class in it

Can someone tell me how to ceate a class that has an array of another class in it?  For example in the code below I want classB to have an array of classA in it.  How would you set this up in classB and how would you initialize it and use it in code?

Class classA
  private mOne as integer
  private mTwo as string
  Sub New()
  End Sub
  Public Property One() As Integer
      Get ...
      Set...
  End Property
  Public Property Two() As String
      Get ...
      Set...
  End Property
End Class

Class B
  private mArrayA as classA ?
  Sub New()
  End Sub
  Public Property arrayA() As classA ?
      Get ??
      Set ??
  End Property
End Class

Thanks in advance....

10-05-2006 at 01:29 AM
View Profile Send Email to User Show All Posts | Quote Reply
stickleprojects
Level: Moderator


Registered: 09-09-2002
Posts: 891
icon Re: Class with an array of another class in it

Hi,
Have you looked at the help on the Array class? Or the Systems.Collection namespace, or even the System.Collections.Generic (2005)?

You need to state the complete path for your type/class rather than the default.
Example (er... translated from c#)
begin class myclass
  private myarr as myclass.mychildclass(5)
  begin class mychildclass
  end class
end class

Hope this helps,
Kieron


____________________________
Build it better, faster, quicker, easier.. then fix it (non-offical MS mission statement)

15-05-2006 at 12:08 AM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB.Net : Class with an array of another class in it
Previous Topic (Drag and Drop and Detection)Next Topic (VB.NET 2005 MsgBox Problems) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder