This should be something simple, but I don't know how to fix it.
here is the code:
{
boProposalCosts.item_amt = boDefaultPrice.item_amt;
}
the funny thing is that it displays the item price in the text box and then the error is thrown and my combo box goes blank.
Here is the stack trace:
InvalidCastException Specified cast is not valid.
Source : Trinity
Stack Trace: at Trinity.BusinessObjects.boProposalCosts.Field_item_fk_Descriptor.SetValue(Object component, Object Value) in F:\Trinity_new\Trinity\BusinessObjects\boProposalCosts.Designer.cs:line 651 at System.Windows.Forms.BindToObject.SetValue(Object value) at System.Windows.Forms.Binding.PullData(Boolean reformat, Boolean force) at System.Windows.Forms.Binding.Target_PropertyChanged(Object sender, EventArgs e) at System.Windows.Forms.ListControl.OnSelectedValueChanged(EventArgs e) at System.Windows.Forms.ComboBox.OnSelectedValueChanged(EventArgs e) at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e) at System.Windows.Forms.ComboBox.WmReflectCommand(Message& m) at System.Windows.Forms.ComboBox.WndProc(Message& m) at MicroFour.StrataFrame.UI.Windows.Forms.ComboBox.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)
What am I missing here? This should be sead simple.
cboitem_fk.SelectedValue = boDefaultPrice.item_pk;
and the problem went away.
Sometimes I would rather be lucky than good