• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 327
  • 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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
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
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.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

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