WFA_psychometric_chart.Form1_main.dataGridView1_CellBeginEdit C# (CSharp) Method

dataGridView1_CellBeginEdit() private method

private dataGridView1_CellBeginEdit ( object sender, System.Windows.Forms.DataGridViewCellCancelEventArgs e ) : void
sender object
e System.Windows.Forms.DataGridViewCellCancelEventArgs
return void
        private void dataGridView1_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
        {

            //--This start the editing of the cells
            //Here we save a current value of cell to some variable, that later we can compare with a new value
            //For example using of dgv.Tag property
            // MessageBox.Show("value  = " + dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
            if (e.RowIndex >= 0 && e.ColumnIndex >= 0)
            {
                this.dataGridView1.Tag = this.dataGridView1.CurrentCell.Value;
                if (dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value != null)
                {
                    beginEditText = dataGridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
                    //Or cast sender to DataGridView variable-> than this handler can be used in another datagridview
                }
            }
        }
Form1_main