Why won't this work?
VB Code:
<Serializable()> Friend Class ExportObject Friend Groups() As [b]New[/b] Group Friend Class Group Friend GroupName As String Friend Members() As Member Friend Sub AddMember(ByVal Name As String, ByVal ID As String) 'make the members object array big enough ReDim Members(Members.GetUpperBound(0) + 1) Members(Members.GetUpperBound(0)).MemberName = Name Members(Members.GetUpperBound(0)).MemberID = ID End Sub End Class Friend Class Member Friend MemberName As String Friend MemberID As String End Class Friend Sub AddGroup(ByVal GroupName As String) Try 'resize the group object array ReDim Groups(Groups.GetUpperBound(0) + 1) Groups(Groups.GetUpperBound(0)).GroupName = GroupName Catch ex As System.NullReferenceException 'if this happens, the group object has not yet been initialized ReDim Groups(0) Groups(0).GroupName = GroupName End Try End Sub End Class
It tells me that arrays can not be declared using "new"
How am I supposed to make an object array from one of my classes?
Thanks in advance,
Squirrelly1




Life is grand for a coder, no?
Reply With Quote