0

Look at this code - I am done on datagridview's CellEndEdit event

private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
    try
    {
        if (e.ColumnIndex == 1)
        {
            if (dataGridView1.Rows[e.RowIndex].Cells[1].Value == null)
            {
                dataGridView1.Rows[e.RowIndex].Cells[4].Value = dataGridView1.Rows[0].Cells[6].Value;
            }

            else
            {
                con.Close();
                if (_chkval == 0)
                {
                    con.Open();
                    string query2 = "select [मालमत्ता क्रमांक] from नमुना८_मालमत्तेची_माहिती where [मालमत्ता क्रमांक] = '" + dataGridView1.CurrentRow.Cells[1].Value + "' ";
                    OleDbCommand adp2 = new OleDbCommand(query2, con);
                    OleDbDataReader dr = adp2.ExecuteReader();
                    if (dr.HasRows && dataGridView1.Rows[e.RowIndex].Cells[1].Value != null)
                    {
                        DialogResult result = MsgBox.Show("मालमत्ता क्रमांक अस्तित्वात आहे.", "सुचना", MsgBox.Buttons.OK, MsgBox.Icon.Warning, MsgBox.AnimateStyle.FadeIn);
                        dataGridView1.CurrentCell = dataGridView1.Rows[e.RowIndex].Cells[1];
                     this.dataGridView1.BeginEdit(false);
                    }
                    con.Close();
                }
            }
Vojtěch Dohnal
  • 7,867
  • 3
  • 43
  • 105
  • What does `I am done on` mean? Add exception details or requested vs. actual behavior. – Vojtěch Dohnal Apr 23 '15 at 11:19
  • Can you be more specific on what you want to accomplish? Are you trying to set the value of the current cell to something other than the user-attempted edit value? – OhBeWise Apr 23 '15 at 22:52

0 Answers0