H
homawong
This bug is very obvious but as I search for it on Internet,
suprisingly I only found it is mentioned in one instance and without a
reply about the issue. That original post is more complicated and I'm
able to trim it down to its simplest form.
All you need is a DataSet, Form and DataGridView.
1. Create a form
2. Create a DataSet with one table with two or more column, say MyTable
[ Col1, Col2].
3. Add a DataGridView to the form and bind to the DataSet
When you run the program:
1. Edit one of the column. Which one doesn't matter, but for demo, lets
say the first column.
2. Tab or click to another column of the same row.
3. Press [Esc] to cancel the edit.
Supposingly, the DataGridView should cancel edit and leave with one row
(the detached row). But instead, DataGridView insert two empty rows to
the DataSet.MyTable, so you have three rows displayed in the
DataGridView (two Added and one detached).
This happens only when the DataGridView is empty, which means it only
have one (the detached) row.
When there are rows in the DataSet already, DataGridView behaves
properly.
Homa Wong
suprisingly I only found it is mentioned in one instance and without a
reply about the issue. That original post is more complicated and I'm
able to trim it down to its simplest form.
All you need is a DataSet, Form and DataGridView.
1. Create a form
2. Create a DataSet with one table with two or more column, say MyTable
[ Col1, Col2].
3. Add a DataGridView to the form and bind to the DataSet
When you run the program:
1. Edit one of the column. Which one doesn't matter, but for demo, lets
say the first column.
2. Tab or click to another column of the same row.
3. Press [Esc] to cancel the edit.
Supposingly, the DataGridView should cancel edit and leave with one row
(the detached row). But instead, DataGridView insert two empty rows to
the DataSet.MyTable, so you have three rows displayed in the
DataGridView (two Added and one detached).
This happens only when the DataGridView is empty, which means it only
have one (the detached) row.
When there are rows in the DataSet already, DataGridView behaves
properly.
Homa Wong