Count rows in a datagrid

How can I count the # of rows in a datagrid?

Thanks,
especht
espechtAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
jrspanoConnect With a Mentor Commented:
You have to count after the data grid is filled. If it is in your form load event it might not work because the data grid hasn't loaded yet.  How are you using it?

use something like
dim rowcnt as integer

rowcnt = datagrid1.approxcount


rowcnt will now have the count.
0
 
Éric MoreauSenior .Net ConsultantCommented:
Use the ApproxCount property.
0
 
espechtAuthor Commented:
emoreau,

I tried that and got the following error:

Run-time error '7005':

Rowset not available.

Any thoughts or ideas?

Thanks,
especht
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Brendt HessSenior DBACommented:
Is your datagrid bound, or unbound?
0
 
espechtAuthor Commented:
The datagrid is bound.
0
 
espechtAuthor Commented:
Answer accepted
0
 
espechtAuthor Commented:
Thanks for everyone's input.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.