We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to save changes of the cell to the data base of DateTimePicker in WinForms GridControl?

Platform: WinForms |
Control: GridControl
Tags: datetime, update

Save the changes to the database

In order to save the changes in database for datetimepicker cell type, GridControl has support to save the cell values using SaveCellInfo event. Using e.ModifyType you can check the status of the cell value like whether it is modified or newly added.


//MonthCalendar celltype
this.gridControl1[1, 2].Text = "MonthCalendar";
this.gridControl1.ColWidths[2] = 100;
this.gridControl1[2, 2].CellType = GridCellTypeName.MonthCalendar;
//Event Handler
Me.gridControl1.SaveCellInfo += gridControl1_SaveCellInfo
void gridControl1_SaveCellInfo(object sender, GridSaveCellInfoEventArgs e)
       //Saves the modified value in a temp variable.
       string temp = e.Style.CellValue.ToString();



'MonthCalendar celltype
 Me.gridControl1(1, 2).Text = "MonthCalendar"
 Me.gridControl1.ColWidths(2) = 100
 Me.gridControl1(2, 2).CellType = GridCellTypeName.MonthCalendar
'Event Handler
 Me.gridControl1.SaveCellInfo += gridControl1_SaveCellInfo
Private Sub gridControl1_SaveCellInfo(ByVal sender As Object, ByVal e As GridSaveCellInfoEventArgs)
 'Saves the modified value in a temp variable.
 Dim temp As String = e.Style.CellValue.ToString()
 End Sub



Save changes of the cell to the database


C#: SaveCellValue_CS

VB: SaveCellValue_VB


2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile