Problems with arrays

G

Guest

Hello
I run into problems on how to create array instances. I'm playing around for
hours now and can't find a solution for this. How can I assign an instance of
the Mysegment class to the rendition segments property?
Any help is greatly appreciated.
Thanks
magriii


Public Class Form1

Partial Public Class Segment
Private segmentNumberField As Integer
Private nameField As String

Public Property SegmentNumber() As Integer
Get
Return Me.segmentNumberField
End Get
Set(ByVal value As Integer)
Me.segmentNumberField = value
End Set
End Property

Public Property Title() As String
Get
Return Me.nameField
End Get
Set(ByVal value As String)
Me.nameField = value
End Set
End Property
End Class

Partial Public Class Segments
Private segmentField() As Segment

Public Property Segment() As Segment()
Get
Return Me.segmentField
End Get
Set(ByVal value As Segment())
Me.segmentField = value
End Set
End Property
End Class

Partial Public Class Rendition
Private idField As String
Private segmentsField As Segments

Public Property ID() As String
Get
Return Me.idField
End Get
Set(ByVal value As String)
Me.idField = value
End Set
End Property

Public Property Segments() As Segments
Get
Return Me.segmentsField
End Get
Set(ByVal value As Segments)
Me.segmentsField = value
End Set
End Property
End Class

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim MyRendition As Rendition = New Rendition
Dim mysegments() As Segments = New Segments() {}
Dim MySegment As Segment = New Segment

MySegment.SegmentNumber = 1
MySegment.Title = "test"

MyRendition.ID = "123"
'''PROBLEM starts here
MyRendition.Segments(0).Segment(0) = MySegment

End Sub
End Class
 
A

Armin Zingler

magriii said:
Hello
I run into problems on how to create array instances. I'm playing
around for hours now and can't find a solution for this. How can I
assign an instance of the Mysegment class to the rendition segments
property?


I don't see a "Mysegment" class, only the Mysegment variable pointing to an
instance of the Segment class. Nevertheless, to make it compilable, you'd
have to write

MyRendition.Segments.Segment(0) = MySegment

but I don't know if this is all you have to do.


Armin
 

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