Where is DataGrid.Rows.Count ?

  • Thread starter Thread starter Fred Morrison
  • Start date Start date
F

Fred Morrison

Is it just me or is there something grossly wrong with the Windows Forms
DataGrid control that won't tell me the row count inside it? I'm not
talking about just visible rows (what the heck good is that, pray tell?). I
want the TOTAL rows count in the DataGrid control. Oh sure, there could be
a bound DataTable, DataView, or whatever that can be rextracted; but, that
means my User Interface has to know something about how the data was bound.
Hey Microsoft. How about a DataGrid.Rows.Count method in the next version?
 
There is no row count on the grid. The new architecture in .NE
attempts to separate the presentation from the data. So thei
philosophy is that the grid doesn't care about the data, onl
displaying it. With that being said, to get a count in your display
you need to contact the BindingManagerBase

BindingManagerBase bm = DataGrid.BindingContext[DataGrid.DataSource];

Then bm.Count will contain the rows.

It's frustrating at first, but most people agree that once you lear
the architecture in .NET it makes a lot more sense and really help
create much more robust apps.

Fred said:
*Is it just me or is there something grossly wrong with the Window
Forms
DataGrid control that won't tell me the row count inside it? I'
not
talking about just visible rows (what the heck good is that, pra
tell?). I
want the TOTAL rows count in the DataGrid control. Oh sure, ther
could be
a bound DataTable, DataView, or whatever that can be rextracted; but
that
means my User Interface has to know something about how the data wa
bound.
Hey Microsoft. How about a DataGrid.Rows.Count method in the nex
version?

pw197
 
Back
Top