例外:索引超出了数组的范围 [英] Exception: Index was outside the bounds of the array

查看:93
本文介绍了例外:索引超出了数组的范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在处理一个主 - 细节关系。绑定到

详细数据的数据网格。浏览记录时(下一条记录:

Me.BindingContext(mDv1).Position + = 1),如果

,我注意到大约2秒的延迟详细数据网格为空(没有为此主记录显示的记录)。

延迟仅在每个应用程序运行时发生一次!在异常调试之后,

发现当发生这种情况时,会抛出第一次机会异常类型

'System.IndexOutOfRangeException''。谁知道如何处理/解决

这种情况​​?


问候科恩

Hi,

I''m dealing with a master-detail relationship. A datagrid bound to the
detail data. When navigating through the records (next record:
Me.BindingContext(mDv1).Position += 1), I notice a delay of about 2 sec''s if
the detail datagrid is empty (no records to show for this master-record). The
delay happens only once per application run!! After exception debugging a
found that when this happens a "first chance exception of type
''System.IndexOutOfRangeException'' is thrown. Who knows how to deal with/solve
this situation?

Regards Coen

推荐答案

Coen


可能是(大致输入这里)

\\\\

如果mDV1.count-2> me.bindingcontext(mDv1).Postition然后

Me.BindingContext(mDv1).Position + = 1)

结束如果

///

我希望这有帮助吗?


Cor
Coen

Probably something as (roughly typed here)
\\\\
if mDV1.count - 2 > me.bindingcontext(mDv1).Postition then
Me.BindingContext(mDv1).Position += 1)
end if
///
I hope this helps?

Cor


您好Cor,感谢您的回复。


不幸的是情况并非如此。只要相关的

详细信息表没有要显示的相关行,就会发生延迟。这可能发生在主行nr 5

100,或者其他任何情况......主表甚至不在他最后的

记录附近。最重要的问题是,每次运行应用程序只运行一次,并且只有相关的详细信息表对于当前的

主记录没有相应的详细信息行。


再次欢迎任何帮助。

问候科恩。


" Cor Ligthert"写道:
Hi Cor, thanks for your response.

Unfortunately this is not the case. The delay happens whenever the related
detail table has no related rows to show. This can happen at master row nr 5
of 100, or whatever... Any case the master table is not even near his last
record. The most important issue is that it always happens only once per
application-run, and only if the related detail table has for the current
master record no corresponding detail rows.

Again, any help is welcome.
Regards Coen.

"Cor Ligthert" wrote:
Coen

如果是mDV1,可能是(在这里大致输入)
\\\\
。 count-2> me.bindingcontext(mDv1).Postition然后
Me.BindingContext(mDv1).Position + = 1)
结束如果
///
我希望这有帮助?

Coen

Probably something as (roughly typed here)
\\\\
if mDV1.count - 2 > me.bindingcontext(mDv1).Postition then
Me.BindingContext(mDv1).Position += 1)
end if
///
I hope this helps?

Cor



Coen,


之后会抛出异常"相同"下一个异常只需要一些

毫秒,所以你可能不会看到它,但你的程序可能更多




从我现在的信息中我看不出它是什么,但是它应该比你描述它的方式在你的相关表格的某个地方。


Cor
Coen,

After that an exception is thrown the "same" next exception takes only some
milliseconds so you will probably not see that however it is probably much
more in your program.

From the information I have now I cannot see what it can be, however it
should than be somewhere in your related table in the way you describe it.

Cor


这篇关于例外:索引超出了数组的范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆