locked
DataGridView CheckBox column question RRS feed

  • Question

  • I have a DGV with a checkbox column, now I want to be able to determine when the checkbox has been checked or unchecked.  What is the event I need to use to call another procedure when the checkstate changes?  Thanks...
    Monday, December 11, 2006 3:37 PM

All replies

  • Hi,

    The events are in the DGV control itself:

    this.groupsDataGridView.CellEndEdit += new

        DataGridViewCellEventHandler( groupsDataGridView_CellEndEdit );

    this.groupsDataGridView.CellValueChanged += new

        DataGridViewCellEventHandler( groupsDataGridView_CellValueChanged );

     

    void groupsDataGridView_CellValueChanged( object sender, DataGridViewCellEventArgs e )

    {

        if ( this.groupsDataGridView.Columns[ e.ColumnIndex ] == this.colCheckbox ) {

            MessageBox.Show( "Value Changed" );

        }

    }

     

    void groupsDataGridView_CellEndEdit( object sender, DataGridViewCellEventArgs e )

    {

        if ( this.groupsDataGridView.Columns[e.ColumnIndex] == this.colCheckbox) {

            MessageBox.Show( "End Edit" );

        }

    }

    Regards,
    Charles

    Tuesday, December 12, 2006 1:04 AM