private void SketchPictureEdit_EditValueChanged(object sender, EventArgs e){ if (SketchPictureEdit.EditValue == new byte[] {}) { this.partsBO1.sketch = new byte[] {}; SketchPictureEdit.EditValue = string.Empty; } else { this.partsBO1.sketch = (byte[])SketchPictureEdit.EditValue; }}
Since I have the control bound to the data already, this was redundant. And, it caused other navigation problems at various points in the user experience.
Thanks for the help!Bill
this
That is why my navigation disappeared. And, also explains the confirmation popup when closing the window.
Whew! Glad that's over.Bill
(note: cross-posted on purpose--http://forum.strataframe.net/Topic13453-7-1.aspx)
This works. I am still running some tests, but at least I have a way around the issue.
Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'.
And, here's the code (offending line specified):
I must have done something different to my previous data table...like set all null values to an empty byte array, or something. It worked before my recent re-import of the data. I'll have to review my records to see what might have happened.
Would you suggest a default value for the 'image' field in a SQL Server data table? Or, would a null value be acceptable? If a null is acceptable, how should I handle it in the BO? Then, how would I handle it in the PictureEdit control?
Thanks!Bill
Well, I am not sure off of the top of my head and will have to setup a test with this control. Bottom line is that the PictureEdit control is trying to set the property to Null...you really want it to be any empty byte array:
Also, you may not want to directly bind to the control. In this example you may want to handle the Navigated event (or something long those lines) and manually set the Picture (or whatever it is) property of the PictureEdit to avoid this type of error. Just some ideas.
If I choose CUT or DELETE from the context menu, I get a DBNull error popping up. Of course, this is not expected (is it ever?) since I spent a good chunk of time yesterday wrestling with the null issue and the image. I thought I had that thing licked.
What can I do about the delete/cut process on the pictureedit control?
Thanks,Bill