CurrentCell Cannot be set to Invisible

CIMStu

Member
Joined
Mar 9, 2010
Messages
13
Programming Experience
Beginner
Hello Everyone

Wonder if you can help me with a rather odd problem i am having...

I have a datagridVIEW which is bound at runtime, various fields are set to visible = false (I need them for referencing but dont want to see them on screen)

On the CellEndEdit Event of the datagrid, i check a variable (which is set to 0, 1 or 2) and display either no dialog (0), or a dialog with another datagrid on it (1 or 2) and depending on whether its 1 or 2 depends on the databinding for that datagrid. The user then updates values in the dialog datagrid which then updates the database.

Once the user has closed that dialog, i set the datasource for my original datagrid to nothing, and re-call the sub-routine that populated it in the first place, to reflect the updated values that the user has changed.

It appears that if my variable is set to 1, it loads the dialog, they do what they need to and it rebinds the datagrid no problem.

For some reason if the variable is set to 2, it loads the dialog, they do what they need to, the dialog close and it gives me the following error 'Current cell cannot be set to an invisible cell'

The dialog that gets loaded is the same regardless of the variable, it is just the contents of the datagrid in the dialog which are different, which makes me think the problem lies there maybe?

I have done some searching and tried various things like setting the currentcell to nothing, or to a cell i know is visible. I've tried focusing on another control, nothing seems to be getting me round this error.

Can anyone give me any suggestions, is the problem likely to lie on the original form when i repopulate the datagrid, or is it more likely in the disposal of the dialogs datagrid the problem is caused? Unfortunately the exception doesnt give me any clues as to which.

Thanks for any advise you can give!
 
Back
Top