我遇到了错误... System.Collections.ArrayList.get_Item(Int32索引) 索引超出范围。必须为非负数并且小于集合的大小
================================================ =
Exception Desc >> Time[20180721_04:44:07] Message[Index was out of range. Must be non-negative and less than the size of the collection 매개 변수 이름: index] Source[mscorlib]StackTrace[ 위치: System.Collections.ArrayList.get_Item(Int32 index)
위치: System.Windows.Forms.ToolStripItemCollection.get_Item(Int32 index)
위치: System.Windows.Forms.ToolStrip.OnPaint(PaintEventArgs e)
위치: System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
위치: System.Windows.Forms.Control.WmPaint(Message& m)
위치: System.Windows.Forms.Control.WndProc(Message& m)
위치: System.Windows.Forms.ScrollableControl.WndProc(Message& m)
위치: System.Windows.Forms.ToolStrip.WndProc(Message& m)
위치: System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
위치: System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
위치: System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)]
================================================ =
为什么我收到此错误??? 我不使用System.Collections.ArrayList.get_Item(int32索引)
这是我的错误点源代码的一部分
private System.Windows.Forms.ToolStripLabel base_MessageBar;
...
public void MyFunctionAtErrorPoint(String str)
{
if (base_MessageBar.ForeColor != Color.Black) base_MessageBar.ForeColor= Color.Black;
this.base_MessageBar.Text = str;
}
环境上,我无法调试。 ***
发生率1/1000000%***
如果发生了,则窗口的ToolStripLabel绘制一个“红色X” ***
答案 0 :(得分:0)
我通过使用调用功能解决了该错误
我在非U.I线程中设置了一些U.I值...
我希望本文对某人有帮助...