Getting error "Operation is not valid due to the current state of the object"

jhennes24

New member
Joined
Aug 21, 2006
Messages
2
Programming Experience
1-3
Getting error "Operation is not valid due to the current state of the object"

I have a custom control that is just the extension of the Xceed.Grid. I have a form that already have this custom control on it, but I dragged another one on to the form and now when I open up the form I get the Build Error Tasks "Operaton is not valid due to the current state of the object". If I close the form, these tasks go away. Any suggestions on how to fix this?

Thanks,

Jan
 
Yout gonna need to post the code for your user control. This happens from time to time if you start to play around with inheriting controls, occasionally things can go a bit off. Most likely a simple fix as long as there isn't pages and pages of code to read through:)
 
Ok, i'm going to hazard a guess being as i don't know much about XceedGrid but the following lines...

VB.NET:
For Each cell In Me.DataRowTemplate.Cells
            AddHandler cell.DoubleClick, AddressOf grid_DoubleClick
        Next

Wouldn't appear to be necessary at design time. Comment out these lines and see if that cures the problem if so change them to the following..

VB.NET:
If Not Me.DesignMode Then
 
  For Each cell In Me.DataRowTemplate.Cells
            AddHandler cell.DoubleClick, AddressOf grid_DoubleClick
        Next
 
End If
 
Back
Top