﻿<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>StrataFrame Forum » StrataFrame Application Framework - V1 » Issues  » TargetInvocationException using MicroFour.StrataFrame.UI.Windows.Forms.DevEx.ComboBoxEdit</title><generator>InstantForum 2017-1 Final</generator><description>StrataFrame Forum</description><link>http://forum.strataframe.net/</link><webMaster>StrataFrame Forum</webMaster><lastBuildDate>Tue, 09 Jun 2026 14:18:28 GMT</lastBuildDate><ttl>20</ttl><item><title>TargetInvocationException using MicroFour.StrataFrame.UI.Windows.Forms.DevEx.ComboBoxEdit</title><link>http://forum.strataframe.net/FindPost28594.aspx</link><description>&lt;div&gt;Hello&lt;br/&gt;&lt;br/&gt;&lt;div&gt;I have a&amp;nbsp;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.&lt;br/&gt;&lt;br/&gt;&lt;div&gt;At runtime, whenever I choose one of the items from the list I get this:&lt;br/&gt;&lt;br/&gt;&lt;div&gt;&lt;span&gt;[code]&lt;/span&gt;&lt;br/&gt;&lt;div&gt;TargetInvocationException&lt;div&gt;&amp;nbsp;&amp;nbsp;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.&lt;div&gt;Parameter name: index'&lt;div&gt;ArgumentOutOfRangeException&lt;div&gt;&amp;nbsp;&amp;nbsp;Index was out of range. Must be non-negative and less than the size of the collection.&lt;div&gt;Parameter name: index&lt;br/&gt;&lt;br/&gt;&lt;div&gt;Source &amp;nbsp; &amp;nbsp; : System&lt;br/&gt;&lt;br/&gt;&lt;div&gt;Stack Trace:&amp;nbsp;&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Collections.ArrayList.get_Item(Int32 index)&lt;div&gt;&amp;nbsp;&amp;nbsp; at MicroFour.StrataFrame.UI.Windows.Forms.ComboBoxItemCollection.get_Item(Int32 Index)&lt;div&gt;&amp;nbsp;&amp;nbsp; at MicroFour.StrataFrame.UI.Windows.Forms.DevEx.ComboBoxEdit.get_SelectedValue()&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.ComponentModel.ReflectPropertyDescriptor.GetValue(Object component)&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Binding.GetPropValue()&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Binding.PullData(Boolean reformat, Boolean force)&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Binding.Target_PropertyChanged(Object sender, EventArgs e)&lt;div&gt;&amp;nbsp;&amp;nbsp; at DevExpress.XtraEditors.Repository.RepositoryItemComboBox.RaiseSelectedValueChanged(EventArgs e)&lt;div&gt;&amp;nbsp;&amp;nbsp; at DevExpress.XtraEditors.ComboBoxEdit.UpdatePopupEditValueIndex(Int32 prevIndex)&lt;div&gt;&amp;nbsp;&amp;nbsp; at DevExpress.XtraEditors.ComboBoxEdit.set_EditValue(Object value)&lt;div&gt;&amp;nbsp;&amp;nbsp; at DevExpress.XtraEditors.PopupBaseEdit.AcceptPopupValue(Object val)&lt;div&gt;&amp;nbsp;&amp;nbsp; at DevExpress.XtraEditors.PopupBaseEdit.UpdateEditValueOnClose(PopupCloseMode closeMode, Boolean acceptValue, Object newValue, Object oldValue)&lt;div&gt;&amp;nbsp;&amp;nbsp; at DevExpress.XtraEditors.PopupBaseEdit.DoClosePopup(PopupCloseMode closeMode)&lt;div&gt;&amp;nbsp;&amp;nbsp; at DevExpress.XtraEditors.PopupBaseEdit.ClosePopup(PopupCloseMode closeMode)&lt;div&gt;&amp;nbsp;&amp;nbsp; at DevExpress.XtraEditors.PopupBaseEdit.ClosePopup()&lt;div&gt;&amp;nbsp;&amp;nbsp; at DevExpress.XtraEditors.Popup.PopupListBox.OnMouseUp(MouseEventArgs e)&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Control.WmMouseUp(Message&amp;amp; m, MouseButtons button, Int32 clicks)&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Control.WndProc(Message&amp;amp; m)&lt;div&gt;&amp;nbsp;&amp;nbsp; at DevExpress.Utils.Controls.ControlBase.WndProc(Message&amp;amp; m)&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Control.ControlNative&amp;#119;indow.OnMessage(Message&amp;amp; m)&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Control.ControlNative&amp;#119;indow.WndProc(Message&amp;amp; m)&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Native&amp;#119;indow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)&lt;br/&gt;&lt;br/&gt;&lt;div&gt;[/code]&lt;br/&gt;&lt;br/&gt;&lt;div&gt;And the combobox gets red x icon on the left saying "invalid item".&amp;nbsp;</description><pubDate>Wed, 06 Oct 2010 18:35:34 GMT</pubDate><dc:creator>Lukasz Kustusz</dc:creator></item><item><title>RE: TargetInvocationException using MicroFour.StrataFrame.UI.Windows.Forms.DevEx.ComboBoxEdit</title><link>http://forum.strataframe.net/FindPost28610.aspx</link><description>Excellent. I thought that might be the problem and often you just have to experiment a bit to figure out the right one, based on how you're loading the Combo.</description><pubDate>Wed, 06 Oct 2010 18:35:34 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: TargetInvocationException using MicroFour.StrataFrame.UI.Windows.Forms.DevEx.ComboBoxEdit</title><link>http://forum.strataframe.net/FindPost28609.aspx</link><description>&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Greg,&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;br/&gt;&lt;/span&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;Thank you for your help. You pointed me in the right direction. I tried to change the Binding property to&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: Verdana, Tahoma, Arial; line-height: 21px; -webkit-border-horizontal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "&gt;&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;SelectedText, but it didn't work. &amp;nbsp;I then tried to bind to a few other properties and it finally worked with SelectedItem. It works with either DevEx and native version of ComboBox.&lt;/span&gt;&lt;/span&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="Verdana, Tahoma, Arial" size="3"&gt;&lt;span class="Apple-style-span" style="font-size: 13px; line-height: 25px; -webkit-border-horizontal-spacing: 1px; -webkit-border-vertical-spacing: 1px;"&gt;&lt;br/&gt;&lt;/span&gt;&lt;/font&gt;</description><pubDate>Wed, 06 Oct 2010 15:59:30 GMT</pubDate><dc:creator>Lukasz Kustusz</dc:creator></item><item><title>RE: TargetInvocationException using MicroFour.StrataFrame.UI.Windows.Forms.DevEx.ComboBoxEdit</title><link>http://forum.strataframe.net/FindPost28605.aspx</link><description>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).&amp;nbsp; You'd need to use SelectedText instead.&amp;nbsp; 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.&amp;nbsp; </description><pubDate>Wed, 06 Oct 2010 13:47:45 GMT</pubDate><dc:creator>Greg McGuffey</dc:creator></item><item><title>RE: TargetInvocationException using MicroFour.StrataFrame.UI.Windows.Forms.DevEx.ComboBoxEdit</title><link>http://forum.strataframe.net/FindPost28599.aspx</link><description>I have some new developments in this issue. I tried to replace the DevEx ComboBox from the SF wrapper with a native SF ComboBox. With this one there is another error whenever I choose an item from the list.:&lt;br/&gt;&lt;br/&gt;&lt;div&gt;&lt;span&gt;[code]&lt;/span&gt;&lt;div&gt;&lt;span&gt;&lt;/span&gt;InvalidCastException&lt;div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;Conversion from type 'DBNull' to type 'String' is not valid.&lt;br/&gt;&lt;br/&gt;&lt;div&gt;Source &amp;nbsp; &amp;nbsp; : Microsoft.VisualBasic&lt;br/&gt;&lt;br/&gt;&lt;div&gt;Stack Trace:&amp;nbsp;&lt;div&gt;&amp;nbsp;&amp;nbsp; at Microsoft.VisualBasic.CompilerServices.Conversions.ToString(Object Value)&lt;div&gt;&amp;nbsp;&amp;nbsp; at ChemineeLining.boEventLog.FieldDescriptor.SetValue(Object component, Object value) in C:\Development\CL_BO_NotesChrono\CL_BO_NotesChrono\CL_BOs\boEventLog.Designer.vb:line 1338&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.BindToObject.SetValue(Object value)&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Binding.PullData(Boolean reformat, Boolean force)&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Binding.Target_PropertyChanged(Object sender, EventArgs e)&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ListControl.OnSelectedValueChanged(EventArgs e)&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ComboBox.OnSelectedValueChanged(EventArgs e)&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ComboBox.WmReflectCommand(Message&amp;amp; m)&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.ComboBox.WndProc(Message&amp;amp; m)&lt;div&gt;&amp;nbsp;&amp;nbsp; at MicroFour.StrataFrame.UI.Windows.Forms.ComboBox.WndProc(Message&amp;amp; m)&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Control.ControlNative&amp;#119;indow.OnMessage(Message&amp;amp; m)&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Control.ControlNative&amp;#119;indow.WndProc(Message&amp;amp; m)&lt;div&gt;&amp;nbsp;&amp;nbsp; at System.Windows.Forms.Native&amp;#119;indow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)&lt;br/&gt;&lt;br/&gt;&lt;div&gt;&lt;div&gt;&lt;span&gt;[/code]&lt;/span&gt;&lt;br/&gt;&lt;div&gt;&lt;br/&gt;&lt;br/&gt;&lt;div&gt;I tried populating the elements at design time , using Edit Items from context menu, or at runtime using following code:&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;div&gt;[code]&lt;div&gt;&lt;div&gt;&amp;nbsp;Me.cboFait.Items.Add("Fait")&lt;div&gt;&amp;nbsp;Me.cboFait.Items.Add("A faire")&lt;div&gt;&amp;nbsp;Me.cboFait.Items.Add("Annule")&lt;div&gt;[/code]&lt;br/&gt;&lt;br/&gt;&lt;div&gt;The Items are there, but as soon as I try to choose one, either by clicking on it, or from the code by setting SelectedItem property, I get the above error.&lt;br/&gt;&lt;br/&gt;&lt;div&gt;If I try to type the value instead, without opening the list, it doesn't accept my value - the business rule is triggered saying that this is a required field and cannot be empty, even though the typed value is there. If I replace the combobox with textbox and type the value, then it's accepted fine. I need this to be a ComboBox though. One that's binded to my BO yet providing default string values to choose from. &amp;nbsp;How can I make it work?</description><pubDate>Wed, 06 Oct 2010 09:56:27 GMT</pubDate><dc:creator>Lukasz Kustusz</dc:creator></item></channel></rss>