ComponentOne True DBGrid for WinForms
Run-Time Interaction / Database Operations / Deleting a Record
In This Topic
    Deleting a Record
    In This Topic

    True DBGrid for WinForms' AllowDelete property must be True in order for the user to delete records through the grid. The default value is False.

    To delete a record, the user selects the row to be deleted by clicking its record selector, then pressing the DEL key. Only one record can be deleted at a time. The user cannot select multiple records and press the DEL key to delete them all.

    In order for the record to be deleted, the grid must have focus so it can receive the DEL key. Clicking the grid's record selector column does not set focus to the grid. However, if you always want the grid to receive focus when the user clicks the record selector column, set focus to the grid in the grid's SelChange event:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Private Sub C1TrueDBGrid1_SelChange(ByVal sender As Object, ByVal e As C1.Win.C1TrueDBGrid.CancelEventArgs) Handles C1TrueDBGrid1.SelChange
        Me.C1TrueDBGrid1.Focus()
    End Sub
    

    To write code in C#

    C#
    Copy Code
    private void C1TrueDBGrid1_SelChange(object sender, C1.Win.C1TrueDBGrid.CancelEventArgs e)
    {
        this.c1TrueDBGrid1.Focus();
    }
    
    See Also