1

Here is the code in VB.NET (using Visual Studio 2010)... in the form_load event.

Dim tNumberInteger(3) As Integer
tNumberInteger(0) = 10
tNumberInteger(1) = 10
tNumberInteger(2) = 10
tNumberInteger(3) = 10
tNumberInteger(4) = 10 ' Suppose to get System.IndexOutOfRangeException here !!!

If I double click on My Project, I have the following settings:

Option Explicit : On
Option Strict: On
Option Compare: On
Option Infer On

Why I don't get the IndexoutOfRangeException on the tNumberInteger(4) = 10 ? Some students have the same problem, on others it's working fine. I don't see any differences in the settings.

MPelletier
  • 16,256
  • 15
  • 86
  • 137
  • Is that your exact code? Are you sure your iNumberInteger is not being redefined or resized elsewhere? – George Johnston Oct 11 '11 at 19:29
  • 1
    possible duplicate of [VS2010 does not show unhandled exception message in a 64-bit WinForms Application](http://stackoverflow.com/questions/4933958/vs2010-does-not-show-unhandled-exception-message-in-a-64-bit-winforms-application) – Hans Passant Oct 11 '11 at 19:33

1 Answers1

2

I also had some problem when dealing with exceptions in the form load event of the main form.

See this bug report from Microsoft for more details.

You can also try your code outside the Form.Load event to see if it fixes your problem.

The_Black_Smurf
  • 5,178
  • 14
  • 52
  • 78