KiRa
KiRa

Reputation: 924

DatagridView cell click event in visual c#

I am learning Windows Visual C# so I am new to this. I have this code for the cell click event for my DataGridView

 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
    {
      con.  ID = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString());
      txtname.Text = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
      txtlname.Text = dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString();
    }

The question is: Even how many times I click my DataGridView it's not firing my breakpoint. How to solve this?

Upvotes: 1

Views: 6537

Answers (1)

Berkay Yaylacı
Berkay Yaylacı

Reputation: 4513

Like this,

You can reach properties by right clicking or pressing F4 after selecting datagridview.

enter image description here

After press lightining icon and double click to event that you like to handle.

enter image description here

Finally you will see this,

enter image description here

Hope helps,

Upvotes: 5

Related Questions