get dataset row count

  • Thread starter Thread starter Sam
  • Start date Start date
S

Sam

Hi,
I've got a datagrid and a dataset used as the datasource.
I'd like to do a test, if the index of the selected row in the grid is
greater than the dataset.tables(0).rows.count. The problem is that if I
edit the last row of the grid, a new row will be added below and to the
dataset. Therefore the number of rows in the dataset won't be equal to
the number of records in the database. How can I get the number of rows
in the dataset originally ?

Thx
 
Sam,

Strange.
The datagrid reflects the rows in your datasource.

There is one time that you can say it is not. And that is while the user is
editing because he/she by instance has added a new row. The data in a
datagrid is not updated in the datasource, as long as the cursor is on the
same datagrid row.

However for that is the instruction Endcurrentedit by instance like this.
\\\\
BindingContext(ds.Tables(0)).EndCurrentEdit()
////

I hope this helps,

Cor
 
So I cut and paste the code from my program. The correct one code
should be

Me.BindingContext(D­ataGrid1.DataSource).Count
 
Back
Top