locked
datagridview current cell issue (checkbox) RRS feed

  • Question

  • This cell is checkbox columns
    myGridView.currentcell=myGridView(1,2)

    executeing the above line error arise

    "operation is not valid because it  results in a reentrant call to the setcurrentcelladdresscore function"

    how can it solve

    • Moved by eryang Wednesday, December 23, 2009 2:07 AM Move to Winform forum for better support. (From:.NET Base Class Library)
    Tuesday, December 22, 2009 1:29 PM

Answers

All replies

  • Hi,

    Your syntax is wrong. Try the following code instead:
    dataGridView1.CurrentCell = dataGridView1.Rows[0].Cells[1];

    Hope that helps


    Regards, Danijel http://arkcore.wordpress.com
    Tuesday, December 22, 2009 4:06 PM
  • Following Danijell answer:
    dataGridView1.CurrentCell.Value = dataGridView1.Rows[0].Cells[1].Value;//if you want to copy values
    

    With best regards, Yasser Zamani
    Tuesday, December 22, 2009 4:16 PM
  • In which event are you trying to write this code? If you are trying to change the value of cell then you can follow the code of Yaseer.

    This error occurs when you try to reselect the current cell forcefully in event like CellEndEdit, CellValidating, CellValueChanged, etc.  To solve this error you can use the code in following link

    http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/thread/f824fbbf-9d08-4191-98d6-14903801acfc/
    Gaurav Khanna
    • Marked as answer by Jing0 Tuesday, December 29, 2009 11:44 AM
    • Unmarked as answer by Saju K Sebastian Wednesday, January 20, 2010 1:07 PM
    • Marked as answer by Saju K Sebastian Friday, May 27, 2011 1:12 PM
    Tuesday, December 22, 2009 5:47 PM