Maybe. I added the following handler to the main form:
The MessageBox appeared on cue at the offending image. And the slide show continued with only the slightest hiccup caused by clearing the image. But the moment I clicked away the MessageBox, there was the OutOfMemoryException waiting for me and the program crashed again -- even several minutes and dozens of images later.vb.net Code:
Sub MyHandler(ByVal sender As Object, ByVal args As UnhandledExceptionEventArgs) Dim e As Exception = DirectCast(args.ExceptionObject, Exception) PicForm2.Opacity = 1 Pic1.Image = Nothing GC.Collect() picIndex += 1 ticks = 0 MessageBox.Show("This is your UnhandledException Handler speaking. I caught : " & e.Message) End Sub
I tried several variations on the above handler. Only putting the MessageBox right at the end succeeded in staving off fate for a while. Other versions (e.g. disposing of Pic1 image) were all worse. They resulted in either a momentary display of the MessageBox immediately followed by the OOM crash, or just the crash. In one variation the Try-Catch message also appeared for a fraction of a second. I really don't understand what is going on here. Any ideas?
BB




Reply With Quote