G
Guest
Hello,
I have a problem whereby I wish to update a dataset bound to a datagrid without the user having to click on the next row of the grid to initiate an update.
I have the following event code for my grid
Private Sub dgMyDatagrid_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgMyDatagrid.CurrentCellChanged
AddHandler dsOrders.Tables.Item("Orders").ColumnChanged, New DataColumnChangeEventHandler(AddressOf Order_Changed)
Call UpdateDataSet(dsOrders, "Orders", MyOrderAdapter)
End Sub
I have the handler for the dataset column change as below
Private Sub GableLadder_Changed(ByVal sender As Object, ByVal e As DataColumnChangeEventArgs)
Call UpdateDataSet(dsOrders, "Orders", MyOrderAdapter)
End Sub
Private Sub UpdateDataSet(ByRef Mydataset As DataSet, ByVal strtable As String, ByVal Myadapter As SqlDataAdapter)
Dim objCommandBuilder As New SqlCommandBuilder(Myadapter)
Myadapter.Update(Mydataset, strtable)
End Sub
The Handler is called when a single column is changed but the underlying dataset is only changed when you click on the row above or below in the datagrid.
How can I get the datasource to update to the database without the user having to click on the next row.
Thnx in advance
Geraldine
I have a problem whereby I wish to update a dataset bound to a datagrid without the user having to click on the next row of the grid to initiate an update.
I have the following event code for my grid
Private Sub dgMyDatagrid_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles dgMyDatagrid.CurrentCellChanged
AddHandler dsOrders.Tables.Item("Orders").ColumnChanged, New DataColumnChangeEventHandler(AddressOf Order_Changed)
Call UpdateDataSet(dsOrders, "Orders", MyOrderAdapter)
End Sub
I have the handler for the dataset column change as below
Private Sub GableLadder_Changed(ByVal sender As Object, ByVal e As DataColumnChangeEventArgs)
Call UpdateDataSet(dsOrders, "Orders", MyOrderAdapter)
End Sub
Private Sub UpdateDataSet(ByRef Mydataset As DataSet, ByVal strtable As String, ByVal Myadapter As SqlDataAdapter)
Dim objCommandBuilder As New SqlCommandBuilder(Myadapter)
Myadapter.Update(Mydataset, strtable)
End Sub
The Handler is called when a single column is changed but the underlying dataset is only changed when you click on the row above or below in the datagrid.
How can I get the datasource to update to the database without the user having to click on the next row.
Thnx in advance
Geraldine