Populating an Array

  • Thread starter Thread starter Wayne Wengert
  • Start date Start date
W

Wayne Wengert

I have a class that defines an array (JudgeTableEntity) which contains sets
of data (Judge) - see class below. I want to put several sets of test data
in the array but cannot find the syntax to do so? Can someone point me to
information or an example of how to do this?

Thanks

Wayne

=============== Class Definition ================
Imports System.Xml

Imports System.Xml.Serialization

Imports System.Collections

Public Class ArrayOfJudgeTableEntity

<XmlArray("JudgeTableEntity"), XmlArrayItem("Judge", IsNullable:=True)> _

Public Judges() As Judge


Public Sub New()

End Sub 'New

End Class 'ArrayOfJudgeTableEntity

Public Class Judge

Public JudgeID As String

Public JudgeFirstName As String

Public JudgeLastName As String

Public JudgeType As String

Public Sub New()

End Sub 'New

Public Sub New(ByVal id As String, ByVal fn As String, ByVal ln As String,
ByVal type As String)

JudgeID = id

JudgeType = type

JudgeFirstName = fn

JudgeLastName = ln

End Sub 'New

End Class 'Judge
 
This test code appears to work. I added a new "New" constuctor to the class
to ReDim the Array. Is that the right way to do this?

' Create some sample Judges info

Dim Judge1 As New Judge("ID1", "Shirlee", "Whitcomb", "GE")

Dim Judge2 As New Judge("ID2", "Joe", "Courtney", "TaP")

Dim array2 As New ArrayOfJudgeTableEntity(2)

array2.Judges(0) = Judge1

array2.Judges(1) = Judge2



===========================================
 

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

Back
Top