Rows In Datagrids

  • Thread starter Thread starter shawrie
  • Start date Start date
S

shawrie

Hi

can anyone tell me what the best way to find out how many rows are in
a datagrid? I used to use datagrid.rows but that doesnt look avaliable
in .NET

Thanks Neil
 
You can get the count from whatever you have set as the datasource for the
grid, whether that be some collection class or a datatable. You will
probably already have a reference to the object so that you can work with it
directly, alternatively you must get the DataSource object from the DataGrid
and it will either implement IList, or IListSource. If the latter you can
call GetList to get the IList implementing object and then retrieve the
count (IList inherits ICollection).

Peter
 
Back
Top