By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,614 Members | 1,620 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,614 IT Pros & Developers. It's quick & easy.

Where is DataGrid.Rows.Count ?

P: n/a
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?
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a

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 Morrison wrote:
*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
-----------------------------------------------------------------------
Posted via http://www.mcse.m
-----------------------------------------------------------------------
View this thread: http://www.mcse.ms/message247812.htm

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.