Hi
Thanks for looking in advance, I'm only a hobbyist so sorry for the code :-)
I'm trying to use both Paging and Binding with VB.Net SfDataGrid however my updates are not being saved back to the DB. I'm using the following code:
Imports System.Data.SQLite
Imports Syncfusion.WinForms.DataGrid.Enums
Module Mod_DataBindingDGV
Public testTable As New DataTable
Public bindingSource1 As New BindingSource
Public adapter As New SQLiteDataAdapter
Public builder As New SQLiteCommandBuilder(adapter)
Public Sub GetDataGridView(ByVal sqlString As String)
Dim sqlCommand As String = sqlString
Dim SQLconnect As New SQLite.SQLiteConnection With {
.ConnectionString = Mod_SQLConnections.CreateSQLiteConnectionString
}
testTable = New DataTable
SQLconnect.Open()
adapter = New SQLiteDataAdapter(sqlCommand, SQLconnect)
adapter.Fill(testTable)
bindingSource1.DataSource = testTable
SQLconnect.Close()
Form1.SfDataGrid1.SuspendLayout()
Form1.SfDataGrid1.ResumeLayout()
Form1.SfDataPager1.DataSource = bindingSource1
Form1.SfDataPager1.PageSize = 5
Form1.SfDataGrid1.DataSource = Form1.SfDataPager1.PagedSource
Form1.SfDataGrid1.AllowEditing = True
Form1.SfDataGrid1.EditMode = EditMode.DoubleClick
End Sub
On Form1
AddHandler SfDataGrid1.CurrentCellEndEdit, AddressOf sfDataGrid_CurrentCellEndEdit
Private Sub sfDataGrid_CurrentCellEndEdit(ByVal sender As Object, ByVal e As CurrentCellEndEditEventArgs)
MessageBox.Show("The editing is completed for the cell (" & e.DataRow.RowIndex & "," & e.DataColumn.ColumnIndex & ")")
End Sub
The data is loaded as expected and pages correctly, also the edit completed MessageBox fires.
Thanks Andy