TargetInvocationException using MicroFour.StrataFrame.UI.Windows.Forms.DevEx.ComboBoxEdit


Author
Message
Lukasz Kustusz
Lukasz Kustusz
StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)StrataFrame Novice (53 reputation)
Group: Forum Members
Posts: 29, Visits: 125
Hello

I have a MicroFour.StrataFrame.UI.Windows.Forms.DevEx.ComboBoxEdit on a SF DevEx MaintenanceForm, which is bound to a BO1. The Combo box has BO1 in BusinessObject property and I filled BindingField to one of the fields in BO1 (btw, how come there's no dropdown on the BindingField on DevEx controls from the Inherited UI wrapper, like there is for native Strataframe controls?) I also fill some values in Edit Values item of the context menu for the control. They are stored in Items collection.

At runtime, whenever I choose one of the items from the list I get this:


TargetInvocationException
  Property accessor 'SelectedValue' on object 'MicroFour.StrataFrame.UI.Windows.Forms.DevEx.ComboBoxEdit' threw the following exception:'Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index'
ArgumentOutOfRangeException
  Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Source     : System

Stack Trace: 
   at System.Collections.ArrayList.get_Item(Int32 index)
   at MicroFour.StrataFrame.UI.Windows.Forms.ComboBoxItemCollection.get_Item(Int32 Index)
   at MicroFour.StrataFrame.UI.Windows.Forms.DevEx.ComboBoxEdit.get_SelectedValue()
   at System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component)
   at System.Windows.Forms.Binding.GetPropValue()
   at System.Windows.Forms.Binding.PullData(Boolean reformat, Boolean force)
   at System.Windows.Forms.Binding.Target_PropertyChanged(Object sender, EventArgs e)
   at DevExpress.XtraEditors.Repository.RepositoryItemComboBox.RaiseSelectedValueChanged(EventArgs e)
   at DevExpress.XtraEditors.ComboBoxEdit.UpdatePopupEditValueIndex(Int32 prevIndex)
   at DevExpress.XtraEditors.ComboBoxEdit.set_EditValue(Object value)
   at DevExpress.XtraEditors.PopupBaseEdit.AcceptPopupValue(Object val)
   at DevExpress.XtraEditors.PopupBaseEdit.UpdateEditValueOnClose(PopupCloseMode closeMode, Boolean acceptValue, Object newValue, Object oldValue)
   at DevExpress.XtraEditors.PopupBaseEdit.DoClosePopup(PopupCloseMode closeMode)
   at DevExpress.XtraEditors.PopupBaseEdit.ClosePopup(PopupCloseMode closeMode)
   at DevExpress.XtraEditors.PopupBaseEdit.ClosePopup()
   at DevExpress.XtraEditors.Popup.PopupListBox.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at DevExpress.Utils.Controls.ControlBase.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)



And the combobox gets red x icon on the left saying "invalid item". 
Reply
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (4.8K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Likely the problem is that BindingProperty isn't setup correctly. This is the property of the combo that is bound to the data. In your second example you are adding strings, so there is no SelectedValue property available (or it is always DBNullValue).  You'd need to use SelectedText instead.  Likely this is also the issue with the first example. It could be that you need to use a different property of the DevEx combo to get the correct value, based on how you are filling it. 
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