Try:
Public Class ClassB
End Class
Public Class ClassA
Public Prop1 As New List(Of ClassB)
End Class
Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
Dim objA As New ClassA
Dim objArray(0) As ClassB
objA.Prop1.Add( New ClassB)
objArray(0) = New ClassB
objA.Prop1.GetT ype.InvokeMembe r("Add", Reflection.Bind ingFlags.Instan ce
Or Reflection.Bind ingFlags.Public Or Reflection.Bind ingFlags.Invoke Method,
Nothing, objA.Prop1, objArray)
MessageBox.Show (objA.Prop1.Cou nt.ToString) ' Result: 2
End Sub
--
Best regards,
Carlos J. Quintero
MZ-Tools: Productivity add-ins for Visual Studio
You can code, design and document much faster:
http://www.mztools.com
<za***@construc tion-imaging.com> escribió en el mensaje
news:11******** *************@g 47g2000cwa.goog legroups.com...
I asked this question before but got no responses. Let me rephrase the
question. I have a class that as a property defined as a list of
classes.
Public Class ClassA
Public Property Prop1 as List(of ClassB)
In a code segment, I can add an instance of ClassB to the Prop1
property of an instance of ClassA with the statement:
myClassA.Prop1. Add myClassB
Can I add an instance of ClassB to the Prop1 List using the
.InvokeMember method of the Type class?