ComboBoxEdit: "Specified Cast is not valid"


Author
Message
StarkMike
StarkMike
StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)
Group: Forum Members
Posts: 436, Visits: 944
I have a ComboBoxEdit (StrataFrame Wrapped version of DevExpress ComboBoxEdit) that is being populated using the PopulationDataSourceSettings property and is bound to a BO and the PopulationType property is set to BusinessObject.



The peculiar thing is that when i start typing in the ComboBoxEdit it begins autocompleting as I type. However if I misspell anyone of the entries in the combo an exception is thrown... Here is the stack:



Specified cast is not valid.



Exception (InvalidCastException): Message="Specified cast is not valid."; Source="STI"; Target=null; Tag=null;



Environment: ThreadIdentity="" DateTime=["2007-08-14 14:44:10.873"] ThreadName=null WindowsIdentity="STRUSS\MMurphy" ThreadId="10" DomainName="STI.vshost.exe" OSVersion=["Microsoft Windows NT 5.1.2600 Service Pack 2"] MachineName="1LPMMURPHY2" UserName="MMurphy"



Remaining Stack Trace

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

at STI.ReturnsBO.FieldRTCustomerIDDescriptor.SetValue(Object component, Object Value) in C:\Documents and Settings\MMurphy\My Documents\Visual Studio 2005\Projects\STI2K5\Business Objects\ReturnsBO.Designer.vb:line 987

at System.Windows.Forms.BindToObject.SetValue(Object value)

at System.Windows.Forms.Binding.PullData(Boolean reformat, Boolean force)

at System.Windows.Forms.Binding.TargetPropertyChanged(Object sender, EventArgs e)

at DevExpress.XtraEditors.Repository.RepositoryItemComboBox.RaiseSelectedValueChanged(EventArgs e)

at DevExpress.XtraEditors.ComboBoxEdit.UpdatePopupEditValueIndex(Int32 prevIndex)

at DevExpress.XtraEditors.ComboBoxEdit.setEditValue(Object value)

at DevExpress.XtraEditors.TextEdit.setText(String value)

at DevExpress.XtraEditors.TextEdit.SetTextCore(String text)

at DevExpress.XtraEditors.PopupBaseAutoSearchEdit.FindUpdateEditValueAutoSearchText()

at DevExpress.XtraEditors.PopupBaseAutoSearchEdit.ProcessFindItem(Int32 selectionStart, Char pressedKey)

at DevExpress.XtraEditors.PopupBaseAutoSearchEdit.ProcessAutoSearchChar(KeyPressEventArgs e)

at DevExpress.XtraEditors.PopupBaseAutoSearchEdit.ProcessChar(KeyPressEventArgs e)

at DevExpress.XtraEditors.PopupBaseAutoSearchEdit.OnEditorKeyPress(KeyPressEventArgs e)

at DevExpress.XtraEditors.BaseEdit.OnKeyPress(KeyPressEventArgs e)

at DevExpress.XtraEditors.TextEdit.OnMaskBoxKeyPress(Object sender, KeyPressEventArgs e)

at System.Windows.Forms.Control.OnKeyPress(KeyPressEventArgs e)

at DevExpress.XtraEditors.Mask.MaskBox.OnKeyPress(KeyPressEventArgs e)

at System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)

at DevExpress.XtraEditors.TextBoxMaskBox.ProcessKeyEventArgs(Message& m)

at System.Windows.Forms.Control.ProcessKeyMessage(Message& m)

at System.Windows.Forms.Control.WmKeyChar(Message& m)

at System.Windows.Forms.Control.WndProc(Message& m)

at System.Windows.Forms.TextBoxBase.WndProc(Message& m)

at System.Windows.Forms.TextBox.WndProc(Message& m)

at DevExpress.XtraEditors.Mask.MaskBox.BaseWndProc(Message& m)

at DevExpress.XtraEditors.Mask.MaskBox.MaskStrategy.SimpleStrategy.DoWndProc(Message& m)

at DevExpress.XtraEditors.Mask.MaskBox.WndProc(Message& m)

at DevExpress.XtraEditors.TextBoxMaskBox.WndProc(Message& msg)

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)





Not sure what is going on. Any ideas?
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
If you bind to an standard SF combo does this happen?  Also, if you create a DevEx combo that is not bound does the error occur?  The first thing I would do is see if the error occurs when you create an SF combo with the same population settings.
StarkMike
StarkMike
StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)StrataFrame User (448 reputation)
Group: Forum Members
Posts: 436, Visits: 944
The error doesnt occur when the comboboxedit isnt bound.... I'll try it with a SF Combobox and let you know.

The reason we like the devexpress one instead of the SF one is because the devexpress one has an autocomplete feature, whereas the SF combo only navigates to the item that begins with the letter pressed. ;-) Just FYI.

Jeff Pagley
Jeff Pagley
StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)StrataFrame User (465 reputation)
Group: StrataFrame Users
Posts: 223, Visits: 893
When using the Strataframe DevExpress Wrapped ComboBoxEdit control, under it's Properties list, set the TextEditStyle property to DisableTextEditor.   The autofill will work fine without throughing an exception.
StrataFrame Team
S
StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)StrataFrame Developer (4.2K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Good tip, jpp, thanks.
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