C# – How to find the number of rows in a DataGrid using .net compact framework

ccompact-frameworknetwindows-mobile

How do you find the number of rows in a DataGrid using .net compact framework?

Best Answer

Try querying the binding context of the DataGrid: DataGrid.BindingContext[DataGrid.DataSource].Count

Or, assuming the data source is a DataTable and you know something about the data source, you can also try ((DataTable)dataGrid1.DataSource).Rows.Count or the equivalent.