Hi Hoboly;
To your question, "why there is a error in this line " cc2 = cc1.FindAll(p1) "?", That is because cc1.FindAll returns a List(Of Car) and not a CarCollection type.
To your question, "How can I solve it and still want to return CarCollection?", The solution to this is simple in the Car class implement Properties this way the List collection can implement IList on your class which is needed by DataGridView.DataSource to get the values to place in the celles.
Friend Class Car
Private _name As String
Public Property name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
Private _price As Integer
Public Property price() As Integer
Get
Return _price
End Get
Set(ByVal value As Integer)
_price = value
End Set
End Property
End Class
Then in your code make these two modifications.
'Dim cc2 As New CarCollection ' Remove this line
Dim cc2 As List(Of Car) ' Put this statement back in
Then it should display the results.
Fernando
Main Topics
Browse All Topics





by: Omego2KPosted on 2009-10-18 at 06:05:53ID: 25599715
change your code to this:
Select allOpen in new window