My application needs to present data generated at run time in a datagrid that
can be sorted by clicking on columns, and where rows can be selected and
events generated.
Do I need to set up a dataset and datatable to do this or can I do this
through arrays (which I believe can not be sorted in a datagrid)?
Can anyone point me towards any samples or in the right direction?
thanks much - Jon
Scott Swigart - 29 Oct 2004 20:49 GMT
You have to put the data in a DataTable. Here's a blog post on gen'ing up a
DataTable from scratch:
http://weblogs.asp.net/dneimke/archive/2003/12/16/43679.aspx
- Scott Swigart
blog - http://ea.3leaf.com
> My application needs to present data generated at run time in a datagrid
> that
[quoted text clipped - 7 lines]
>
> thanks much - Jon
Jay B. Harlow [MVP - Outlook] - 30 Oct 2004 17:01 GMT
Jon,
Using a DataSet & DataTable is easier...
However! if you put your data in a collection that implements IBindingList
such as:
Public Class Data
End Class
Public Class DataCollection
Inherits CollectionBase
Implements System.ComponentModel.IBindingList
...
End Class
You can bind an instance of DataCollection to your DataGrid and it will be
sortable.
Rockford Lhotka's book "Expert One-On-One Visual Basic .NET Business
Objects" from A! Press, provides demonstrates how to implement IBindingList.
http://www.lhotka.net
Post if you would like other samples.
Hope this helps
Jay
> My application needs to present data generated at run time in a datagrid
> that
[quoted text clipped - 7 lines]
>
> thanks much - Jon