DataGridView CurrentCell Issue?


Hello IceTeaGroup

I’m working with a DataGridView with different CellTypes. I added the CellClickEvent to handle wich Cell was clicked.

I placed a DataGridView to a Panel, set up the columns in the property window / columneditor to use every type of possible ColumnType (DataGridViewButtonColumn, DataGridViewCheckBoxColumn and so on).

In codebehind I just used

DataGridViewRow row = new DataGridViewRow();

to add a DataGridViewRow to the DataGridView.

My ClickEvent looks like this:

 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
DataGridView mainSender = (DataGridView)sender;


The issue what I got is, the CurrentCell property isn’t updated propabbly. So I click on an ImageCell and get the message output: “Wisej.Web.DataGridViewCell”, next I click on a ButtonCell and get the previous clicked: “Wisej.Web.DataGridViewImageCell”


Am I doing something wrong or is it a real issue?


Best regards


  • You must to post comments

Use the e.ColumnIndex, e.RowIndex passed in the event. The CurrentCell is the cell with the focus frame which may not be the one clicked. datagridview[e.ColumnIndex, e.RowIndex].

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.