Hi!
I have a class inherited from CollectionBase. It binds perfectly to a control (DataGrid or GridView).
What I want is to change the order of the CollectionBase members so that it will appear as I want it to the DataGrid as columns?
Here is some code.
Public Class Contact
Private Name As String
Private Fax As String
End Class
Public Class ContactCollection
Inherits CollectionBase
Default Public Property Item(ByVal index As Integer) As Contact
Get
Return CType(List(index), Contact)
End Get
Set(ByVal value As Contact)
List(index) = value
End Set
End Property
End Class
When I do:
DataGrid.Datasource = ContactCollection
A column name "Fax" appear first and the "Name" as second column of the Datagrid.
I want to make Name to be the first column and Fax as the second column.
I hope there is a solution by adding some code in the Contact and ContactCollection class not by re-ordering the columns of the Datagrid.
Thanks! I appreciate any help.
I have a class inherited from CollectionBase. It binds perfectly to a control (DataGrid or GridView).
What I want is to change the order of the CollectionBase members so that it will appear as I want it to the DataGrid as columns?
Here is some code.
Public Class Contact
Private Name As String
Private Fax As String
End Class
Public Class ContactCollection
Inherits CollectionBase
Default Public Property Item(ByVal index As Integer) As Contact
Get
Return CType(List(index), Contact)
End Get
Set(ByVal value As Contact)
List(index) = value
End Set
End Property
End Class
When I do:
DataGrid.Datasource = ContactCollection
A column name "Fax" appear first and the "Name" as second column of the Datagrid.
I want to make Name to be the first column and Fax as the second column.
I hope there is a solution by adding some code in the Contact and ContactCollection class not by re-ordering the columns of the Datagrid.
Thanks! I appreciate any help.