• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 323
  • Last Modified:

Count rows in a datagrid

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

Thanks,
especht
0
especht
Asked:
especht
1 Solution
 
É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
 
Brendt HessSenior DBACommented:
Is your datagrid bound, or unbound?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
espechtAuthor Commented:
The datagrid is bound.
0
 
jrspanoCommented:
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
 
espechtAuthor Commented:
Answer accepted
0
 
espechtAuthor Commented:
Thanks for everyone's input.
0

Featured Post

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.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now