I have written and tested a WinForms application and everything works fine on my machine (cliche, I know). When I created a setup project and installed it on a co-worker's machine, he receives the following message:
************** Exception Text **************
System.IndexOutOfRangeException: There is no row at position 0.
at System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex)
at System.Data.RBTree`1.get_Item(Int32 index)
at System.Data.DataRowCollection.get_Item(Int32 index)
at MyApp.MainForm.MainForm_Load(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
I will admit I am a beginner when it comes to handling exceptions like this one. The text doesn't make a whole lot of sense to me and I'm unsure of the best way to debug this since I can't get the error to occur on my machine.
Can anyone tell what the problem is, or advise me on the best way to debug this? Any help is greatly appreciated!
Apparently you are using a DataRowCollection object on your main form load event handler, and this DataRowCollection object is empty (i.e. contains no rows). The form load event handler seems to assume that it will not be empty.
I suggest you set a breakpoint (F9) on the opening brace of MainForm_Load and step (F10 or F11) through your code until you find where the code tries to use the DataRowCollection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With