We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

CheckBox cell throwing (handled) exceptions

I have an custom IncomeCollection collection class bound to a GDBG. IncomeCollection holds Income objects. The Income class has a public PrimaryFlag property of type Boolean. A column in the GDBG is bound to the PrimaryFlag property, and it''s GridBoundColumn.StyleInfo.CellType is set to "CheckBox". When I check/uncheck a checkbox in the PrimaryFlag column, there are 3 ''System.ArgumentException'' exceptions thrown with additional information of ''Cannot widen from target type to primitive type.''. The first 2 are in system.dll, the last one is in syncfusion.grid.dll. They are handled inside the grid control, (I just get the first-chance exceptions), but is this normal, or am I doing something wrong? ----- Lee Perkins

3 Replies

LP Lee Perkins June 11, 2004 10:02 AM

Update to my previous post: If I ignore First-Chance exceptions, there is a runtime effect to these exceptions. Once I check one of the checkboxes in the PrimaryFlag column, if I try to click off the checkbox cell to cell in another row, I get a msgbox that says "Cannot widen from target type to primitive type." and it won''t let me off the cell. If I try to click off the checkbox cell to another cell in the same row, it lets me. If I then try to click on any cell in another row, I get a msgbox that says "Object type cannot be converted to target type." These msgboxes aren''t exceptions, they seem to be coming from the grid control. If I use the keyboard and hit the SpaceBar while in the checkbox cell, I actually get the "Cannot widen from target type to primitive type." exception bubbled up to me, unhandled. ----- Lee Perkins


AD Administrator Syncfusion Team June 11, 2004 10:42 AM

Also try setting the GridBoundColumn.StyleInfo.CellValueType to GetType(Boolean). Also set GridBoundColumn1.StyleInfo.CheckBoxOptions = CheckBoxOptions = New GridCheckBoxCellInfo(Boolean.TrueString, Boolean.FalseString, "", False)


LP Lee Perkins June 11, 2004 11:39 AM

Thanks for the suggestion. I think I found the problem though. The PrimaryFlag property was (for some UNKNOWN and UNNOTICED reason!) was Integer, not Boolean. Haven''t had a chance to test it again since I changed it to Boolean, but will test it Monday morning. :) ----- Lee Perkins

Loader.
Live Chat Icon For mobile
Up arrow icon