How do I find out how many items have been populated into a datagrid?

Lemon

Member
Joined
Jul 1, 2005
Messages
12
Programming Experience
1-3
I need help! I just need to find out (if its possible) to retrieve or count the amount of records that have been populated to the datagrid from a query...

Basically test if the amount of records is > 1...

If you have any Ideas, please help!!!
 
just check the dataset.datatable for the number of rows before you bind it to datagrid

dataset.tables(0).rows.count

or is there not a datagrid.rows.count aswell somewhere??
 
Dataset Record Count

You could also use BindingContext to retrieve the record count:

Me.BindingContext(DsTableName1, "Table Name").Count

VB.NET:
		If Me.BindingContext(DsTableName1, "Table Name").Count > 0 Then
			'do stuff here

		Else
			MsgBox("There are 0 records that match criteria..")
		End If
 
Last edited:
Back
Top