Error being thrown in Win 8.1 but not Win 7 nor Vistsa. Appears to be form closing event.

I have an app that is causing errors to be thrown on a couple of forms during the closing event. Th error is only showing up on Windows 8.1. Win 7 and Vista are not throwing the error.

Is this bad code where the older OS's were forgiving me or is it something else? The APP is in 2008. I can click continue on the error and the APP keeps running as intended.

Unfortunately my debugging is limited because I do not have Win 8.1.

Can you post error raised?

Can you post error raised?

If we do not know what the error is, we cannot answer.

Also, is it always happening on the same forms. Calling Close on these forms will also trigger the FormClosing error on them, so it might be where you have a problem. The code that you are showing should usually not give problems by itself.

Hold on I will get them to send me a screen shot

Message from error box

And you say it worked before? I focused on that statement and did not look further. But with the error message, it becomes evident.

You cannot remove elements from a collection when you loop with a for each. You have to do it in reverse with the "standard" for, replacing each instance of frm by Me.MdiParent.MdiChildren(x):
For x As Integer = Me.MdiParent.MdiChildren.Count-1 to 0 Step -1
If TypeOf Me.MdiParent.MdiChildren(x) Is Form2 ... Then
End If

Share this

Related Posts