How to delete current record in WinForms GridGroupingControl?
Delete the record
By default, in our WinForms GridGroupingControl, the delete key is pressed to delete a record, only the current cell value will be deleted. To delete the entire row, TableControlCurrentCellKeyDown event can be used and in that event current record can be deleted by using Record.Delete method.
C#
//Event Subscription
gridGroupingControl1.TableControlCurrentCellKeyDown += GridGroupingControl1_TableControlCurrentCellKeyDown;
//Event Customization
private void GridGroupingControl1_TableControlCurrentCellKeyDown(object sender, GridTableControlKeyEventArgs e)
{
if (e.Inner.KeyData == Keys.Delete && e.TableControl.Table.CurrentRecord != null)
{
Record currentRecord = e.TableControl.Table.CurrentRecord;
currentRecord.Delete();
}
} VB
'Event Subscription
AddHandler gridGroupingControl1.TableControlCurrentCellKeyDown, AddressOf GridGroupingControl1_TableControlCurrentCellKeyDown
'Event Customization
Private Sub GridGroupingControl1_TableControlCurrentCellKeyDown(ByVal sender As Object, ByVal e As GridTableControlKeyEventArgs)
If e.Inner.KeyData = Keys.Delete AndAlso e.TableControl.Table.CurrentRecord IsNot Nothing Then
Dim currentRecord As Record = e.TableControl.Table.CurrentRecord
currentRecord.Delete()
End If
End SubSamples:
Conclusion
I hope you
enjoyed learning about how to delete the current record in the WinForms
GridGroupingControl.
You can refer to our WinForms GridGroupingControl feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms GridGroupingControl documentation to understand how to manipulate data.
For current customers, you can check out on our Winforms components from the License and Download page. If you are new to Syncfusion, you can try our 30-day free trial to check out our Winforms GridGroupingControl and other WinForms components.
If you have any queries or require clarifications, please let us know in the comment section below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!