Hi,
I am using Infragistics Winform Controls 2008 Volume 1 and facing the problem in UltraComboBox. The error string is:
Internal Error: "Can't convert to DestinitionValue in UltraComboBox".
Although I have lots of combo boc on my screen but only one combo box is showing this error.
I am using the following code to bind the combo box:
cmbRegion.DataSource = LookupData.Regions (<<This is generic list of well defined objects>>)
cmbRegion.DisplayLayout.Bands(0).Columns(RegionColumnData.REGION_CODE.Value).SortIndicator = Infragistics.Win.UltraWinGrid.SortIndicator.Ascending
If (cmbRegion.Rows.Count > 0) Then
cmbRegion.SelectedRow = cmbRegion.Rows(0)
End If
cmbRegion.DisplayMember = RegionColumnData.DESCR.Value
cmbRegion.ValueMember = RegionColumnData.REGION_CODE.Value
If in the above I am using REGION_ID as Value Member then there is no problem, the code runs fine but if I use REGION_CODE then it shows the above error. The only difference is REGION_CODE is String and REGION_ID is Integer.
I am using the same code to bindsome other combo box also and setting the value member as Code instead of ID but they are working fine.
The stack trace of the problem is as follows:
at Infragistics.Win.EmbeddableEditorBase.GetDataFilteredDestinationValue(Object sourceVal, ConversionDirection direction, EmbeddableEditorOwnerBase owner, Object ownerContext)\r\n
at Infragistics.Win.UltraWinGrid.UltraCombo.get_Value()\r\n
at Infragistics.Win.UltraWinGrid.UltraGridComboEditorOwner.GetValue(Object ownerContext)\r\n
at Infragistics.Win.EmbeddableEditorBase.GetDataFilterSourceValue(ConversionDirection direction, EmbeddableEditorOwnerBase owner, Object ownerContext)\r\n
at Infragistics.Win.EmbeddableEditorBase.GetDataFilteredDestinationValue(ConversionDirection direction, Boolean& isValidConversion, EmbeddableEditorOwnerBase owner, Object ownerContext)\r\n
at Infragistics.Win.EmbeddableEditorBase.GetDataFilteredDestinationValue(ConversionDirection direction, EmbeddableEditorOwnerBase owner, Object ownerContext)\r\n
at Infragistics.Win.EditorWithCombo.GetElementText(EmbeddableUIElementBase element, Boolean ignorePasswordChar)\r\n
at Infragistics.Win.EditorWithTextUIElement.PositionChildElements()\r\n
at Infragistics.Win.UIElement.VerifyChildElements(ControlUIElementBase controlElement, Boolean recursive)\r\n
at Infragistics.Win.UIElement.DrawHelper(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean clipText, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics)\r\n
at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize, Boolean preventAlphaBlendGraphics)\r\n
at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode)\r\n
at Infragistics.Win.UltraControlBase.OnPaint(PaintEventArgs pe)\r\n
at Infragistics.Win.UltraWinGrid.UltraCombo.OnPaint(PaintEventArgs e)\r\n
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)\r\n
at System.Windows.Forms.Control.WmPaint(Message& m)\r\n
at System.Windows.Forms.Control.WndProc(Message& m)\r\n
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)\r\n
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)\r\n
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)\r\n
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageA(MSG& msg)\r\n
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)\r\n
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)\r\n
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)\r\n
at System.Windows.Forms.Application.Run(ApplicationContext context)\r\n
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()\r\n
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()\r\n
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)\r\n
at BLAC.WinUI.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81\r\n
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n
at System.Threading.ThreadHelper.ThreadStart()"
My best guess is that this is caused by your setting the SelectedRow on the combo before you set the ValueMember and DisplayMember. Setting the SelectedRow is going to set the Value and text of the combo to the first field in the list. Then you are trying to change the ValueMember after the control already has a value and that value is of a different data type than the column you are assigning.
So try setting ValueMember and DisplayMember before setting the SelectedRow.
Hi Mike,
Thanks for your support. That was just the problem.
I tried setting the value member before selecting the row and it works. This is just the solution I am searching for.
-Regards,
Ashish Sharma