R
Rob Perkins
The following code snipped is intended to delete a row from a typed
dataset. The name of the dataset instance is "dbMats", which contains a
table called "CastingAlloys". Instead of deleting the row it is actually
moving the row to be the first item in the dataset's "CastingAlloys"
table.
I haven't been able to figure out why.
The UI for the dataset is a ListBox, with the DataSource property of the
ListBox set to the "CastingAlloys" table in the dataset. The
DisplayMember and ValueMember properties are likewise bound to fields in
the table.
When a user clicks on one of the ListBox items, a subroutine is called
which *copies* the database values from the selected row into a separate
data structure, which is in turn bound to other UI elements on the form.
There is no further interaction between those UI elements and the
ListBox. (They are view-only elements)
I'm making use of the MSDataSetGenerator-generated method,
"RemoveCastingAlloysRow", and can't figure out why the row doesn't
actually *get removed*.
Any ideas?
Rob
dataset. The name of the dataset instance is "dbMats", which contains a
table called "CastingAlloys". Instead of deleting the row it is actually
moving the row to be the first item in the dataset's "CastingAlloys"
table.
I haven't been able to figure out why.
The UI for the dataset is a ListBox, with the DataSource property of the
ListBox set to the "CastingAlloys" table in the dataset. The
DisplayMember and ValueMember properties are likewise bound to fields in
the table.
When a user clicks on one of the ListBox items, a subroutine is called
which *copies* the database values from the selected row into a separate
data structure, which is in turn bound to other UI elements on the form.
There is no further interaction between those UI elements and the
ListBox. (They are view-only elements)
I'm making use of the MSDataSetGenerator-generated method,
"RemoveCastingAlloysRow", and can't figure out why the row doesn't
actually *get removed*.
Any ideas?
Dim r As dbMats.CastingAlloysRow
Try
r = CType(CType(lstdbCastingMats.SelectedItem, DataRowView).Row, dbMats.CastingAlloysRow)
Try
lstdbCastingMats.SelectedIndex = lstdbCastingMats.SelectedIndex + 1
Catch ex As Exception
lstdbCastingMats.SelectedIndex = 0
End Try
ds.CastingAlloys.RemoveCastingAlloysRow(r)
'CType(lstdbCastingMats.SelectedItem, DataRowView).Delete()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Rob