How do you find the number of rows in a DataGrid using .net compact framework?
C# – How to find the number of rows in a DataGrid using .net compact framework
ccompact-frameworknetwindows-mobile
Related Topic
- .net – the best algorithm for overriding GetHashCode
- C# – Path.Combine for URLs
- C# – How to handle multiple submit buttons in ASP.NET MVC Framework
- C# – How to get a consistent byte representation of strings in C# without manually specifying an encoding
- C# – How to get the application’s path in a .NET console application
- C# – How to get the current username in .NET using C#
- R – How to recompile Sharp Architecture library to use NHIbernate 2.1.0.4000 instead of 2.1.0.3001
- .net – the difference between .NET Core and .NET Standard Class Library project types
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.