Error System.ArgumentOutOfRangeException: Value of '-1' is not valid for 'Value'. 'Value' should be...


Error System.ArgumentOutOfRangeException: Value of '-1' is not valid...
Author
Message
Leonard P.
Leonard P.
StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)
Group: Awaiting Activation
Posts: 65, Visits: 306
Hi,

I am getting a Framework error (see more info below), when opening maintenance form from the main window:



ProductMaintenance maintForm = new ProductMaintenance(this.factSheetReportBO.Product_Id);

maintForm.ShowDialog(this);




The main window passes in PK_ID and maintenance form navigates to that ID. The error only happens for one specific PK ID. There's nothing special about this ID, I can't figure out why it would fail on that ID.

By looking at the error message can you tell me what can be causing it, or at least point me to the right direction?





System.ArgumentOutOfRangeException: Value of '-1' is not valid for 'Value'. 'Value' should be between 'Minimum' and 'Maximum'.\rParameter name: Value\r at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value)\r at System.Windows.Forms.Binding.SetPropValue(Object value)\r at System.Windows.Forms.Binding.PushData(Boolean force)\r at System.Windows.Forms.Binding.UpdateIsBinding()\r at System.Windows.Forms.Binding.CheckBinding()\r at System.Windows.Forms.Binding.SetListManager(BindingManagerBase bindingManagerBase)\r at System.Windows.Forms.ListManagerBindingsCollection.AddCore(Binding dataBinding)\r at System.Windows.Forms.BindingsCollection.Add(Binding binding)\r at System.Windows.Forms.BindingContext.UpdateBinding(BindingContext newBindingContext, Binding binding)\r at System.Windows.Forms.Control.UpdateBindings()\r at System.Windows.Forms.Control.OnBindingContextChanged(EventArgs e)\r at System.Windows.Forms.ContainerControl.

OnCreateControl()\r at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)\r at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)\r at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)\r at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)\r at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)\r at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)\r at System.Windows.Forms.Control.CreateControl()\r at System.Windows.Forms.Control.WmShowWindow(Message& m)\r at System.Windows.Forms.Control.WndProc(Message& m)\r at System.Windows.Forms.ScrollableControl.WndProc(Message& m)\r at System.Windows.Forms.ContainerControl.WndProc(Message& m)\r at System.Windows.Forms.Form.WmShowWindow(Message& m)\r at System.Windows.Forms.Form.WndProc(Message& m)\r at System.Windows.Forms.Control.ControlNativewindow.OnMessage(Message& m)\r at System.Windows.Forms.Control.ControlN

ativewindow.WndProc(Message& m)\r at System.Windows.Forms.Nativewindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)"



Edhy Rijo
E
StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)StrataFrame VIP (4.6K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Leonard,

System.ArgumentOutOfRangeException: Value of '-1' is not valid for 'Value'.

It looks like your this.factSheetReportBO.Product_Id value is -1 which means that you are adding a record and the PK has not been saved, you may want to either make sure your Product_Id is a valid PK at the calling form.

Edhy Rijo

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Well, I would assume from looking at the message that you have this field bound to something.  Possibly  a numeric up down control with a Min and Max range.  It may not be this field but another that is bound.  That would be the first place I would look.
Leonard P.
Leonard P.
StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)StrataFrame Novice (81 reputation)
Group: Awaiting Activation
Posts: 65, Visits: 306
Trent L. Taylor (10/23/2008)
Well, I would assume from looking at the message that you have this field bound to something. Possibly a numeric up down control with a Min and Max range. It may not be this field but another that is bound. That would be the first place I would look.




Trent, that was exactly it!!! I spent hours looking at the code and form's controls. And you nailed it right away without seeing my form! You are a genius!!! Thank you!
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
LOL...glad you found it Smile
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search