Sunday, March 8, 2009

Implantation Bleeding On Sonogram

VFP 6 SP5. NET CF: A mistake that cost me a whole day

'm in the middle of a project for a mobile application with . NET CF 2.0 and WM 6.0 .

Today I started the morning with every intention of finishing what I needed for the project. But what was my surprise when wanting to run the program, it failed with an exception of type ObjectDisposedException .

The error occurred when assigning a value to the property SelectedIndex a ListBox . Data from the ListBox came from a brand built on the DataTable to hold the data to be displayed in the ListBox .

far as I could understand the error occurred because the data source associated with Listbox for some reason did not exist in memory when assigning the value of SelectedIndex, which was almost impossible because both lines were immediately adjacent code. After

spend all day looking at the causes Google of the error and possible solutions, so far, at 9:15 pm when I have realized that what was causing the error that I put code in the event of ListBox SelectedIndexChanged that caused the closure of form.

Since this event is called IMMEDIATELY after a value assigned to the DataSource property , SelectedIndexChanged event is fired and invoked the code that resulted in this.Close () , which in turn caused the release of all resources, including the associated DataSource ListBox, which is why when you get to SelectedIndex is generating the error in question.

Simply amazing! These are errors which, many times, causing delays in projects.

0 comments:

Post a Comment