Home Forums WinForms controls Xceed Grid for WinForms Help in creating handler Reply To: Help in creating handler

User (Old forums)
Member
Post count: 23064

Here is a code snippet that shows a very basic implementation of this, and is certainly not recommended with large datasets. It is only an illustration, so you can get you going when using events and DB objects.

<code>
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

‘the binding can be done in the designer
GridControl1.SetDataBinding( DataSet11.Customers, “” )
detailGridTemplate1.SetDataBinding( DataSet11.Customers, “CustomersOrders” )
detailGridTemplate2.SetDataBinding( DataSet11.Customers, “CustomersOrders.OrdersOrder_x0020_Details” )

For Each cell As Cell In dataRowTemplate1.Cells
AddHandler cell.ValueChanged, AddressOf cell_ValueChanged
Next

OleDbDataAdapter1.Fill(DataSet11)
OleDbDataAdapter2.Fill(DataSet11)
OleDbDataAdapter3.Fill(DataSet11)

End Sub

Private Sub cell_ValueChanged(ByVal sender As Object, ByVal e As EventArgs)

‘this updates the DB
OleDbDataAdapter1.Update(DataSet11)
OleDbDataAdapter2.Update(DataSet11)
OleDbDataAdapter3.Update(DataSet11)

End Sub
</code>

Imported from legacy forums. Posted by André (had 229 views)