Maybe it's just me, but this seems correct.
I have a dataset pointing to an MS Access db, I can fill the dataset and seea ll of the information in there. But When I go to update the DB, I want to update the row selected in my combobox.
Here's the code I have:
Public Function GetRow() As DataRow
On Error Resume Next
Dim bm As BindingManagerBase
Dim drv As DataRowView
bm = Me.BindingContext(DataSet, "table")
drv = CType(bm.Current, DataRowView)
GetRow = drv.Row
MsgBox(drv.Row.ToString)
Return GetRow
End Function
Then I call the function when I need the row number:
Dim drCurrent As DataRow
drCurrent = GetRow()
drCurrent.Item("Column1") = TextBox2.Text
drCurrent.Item("Column2") = TextBox1.Text
Me.BindingContext(DataSet, "table").EndCurrentEdit()
Me.TableAdapter.Update(DataSet)
Yet the row that get's updated it not the row I have selected.
Anyone know of a better way to do this ?
Mootser13
I have a dataset pointing to an MS Access db, I can fill the dataset and seea ll of the information in there. But When I go to update the DB, I want to update the row selected in my combobox.
Here's the code I have:
Public Function GetRow() As DataRow
On Error Resume Next
Dim bm As BindingManagerBase
Dim drv As DataRowView
bm = Me.BindingContext(DataSet, "table")
drv = CType(bm.Current, DataRowView)
GetRow = drv.Row
MsgBox(drv.Row.ToString)
Return GetRow
End Function
Then I call the function when I need the row number:
Dim drCurrent As DataRow
drCurrent = GetRow()
drCurrent.Item("Column1") = TextBox2.Text
drCurrent.Item("Column2") = TextBox1.Text
Me.BindingContext(DataSet, "table").EndCurrentEdit()
Me.TableAdapter.Update(DataSet)
Yet the row that get's updated it not the row I have selected.
Anyone know of a better way to do this ?
Mootser13