开发者

VB.NET Visual Studio 2010 Don't get IndexOutOfRangeException

开发者 https://www.devze.com 2023-04-12 20:49 出处:网络
Here is the code in VB.NET (using Visual Studio 2010)... in the form_load event. Dim tNumberInteger(3) As Integer

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开发者_如何学JAVA'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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号