Hello, I am trying to pass a generic custom collection "Public Class xList(of T) Inherits BindingList(of T)" to a form which will display the contents of the collection in a datagridview. As i do not know at design time what the type is within the collection, then the form that is going to display the data is going to have to find out what type is in the collection when is initializes.
The problem i am having is passing the generic collection to the form.
' The custom collection
Public Class xList(of T) Inherits BindingList(of T)
...
End Class
' The form to display objects, this is where the problem is, it will not accept (of T)
Public Class form1
Public sub New (ByVal x as xList(of T))
'code to find type
...
End Sub
End Class
'Code passing the collection, contained in another form
Public sub passx(A as TypeA)
dim x as xList(of TypeA) = new xList(of TypeA)
x.Add(A)
dim frm as form1 = new form1(x)
frm.showdialog
...
End sub
hopefully this makes sense to someone.
Thanks to all in advance.
Andy
Start Free Trial