Hi
I'm using your sample that is posted online and when I paste the code in to VS2017 and Infragistics 16.1 Win CLR4x I get two Errors
Option Strict On Disallows implict conversions from UIElement to EmdeddableUIElementBaseOption Strict On Disallows implict conversions from Object to EmdeddableEditorBase
Swiching Option Strict to Off is not acceptable and it doesn'y help anyway.
Can you tell me why and how do I stop this from happening.
RegardsPaul
From www.infragistics.com/.../infragistics.win.ultrawinlistview~infragistics.win.ultrawinlistview.ultralistviewitem~uielementPrivate Sub ultraListView1_ItemEnteredEditMode(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinListView.ItemEnteredEditModeEventArgs) Handles ultraListView1.ItemEnteredEditMode ' If the embeddable editor for this item supports a dropdown, ' call the DropDown method. Dim embeddableElement As EmbeddableUIElementBase = e.Item.UIElement.GetDescendant(GetType(EmbeddableUIElementBase), e.Item) Dim editor As EmbeddableEditorBase = IIf(Not embeddableElement Is Nothing, embeddableElement.Editor, Nothing) If (Not editor Is Nothing AndAlso editor.SupportsDropDown) Then editor.DropDown() End If End Sub
Hi Paul,
You can resolve this by using CType to cast instead of the As operator. Please let me know if this works for you.
I will look into changing our sample to avoid this error.
Thank you for your reply. I did first attempt the CType with the code shown below but you still get a 'Unable to cast object of type' exception. I've just used a ultraListView1, added an ultraCombox, linked this to the mainColumn.EditorComponent and added 1 Item. You click on the dropdown combo arrow, you get the exception, if you trap the exception and continue the combobox shows.
Look forward to how to correct this.
Dim embeddableElement As EmbeddableUIElementBase = CType(e.Item.UIElement.GetDescendant(GetType(EmbeddableUIElementBase), e.Item), EmbeddableUIElementBase)
Dim editor As EmbeddableEditorBase = CType(IIf(Not embeddableElement Is Nothing, embeddableElement.Editor, Nothing), EmbeddableEditorBase) If (Not editor Is Nothing AndAlso editor.SupportsDropDown) Then editor.DropDown() End If
Thank you for reply. That works perfectly.
I hope this helps other as it's been a learning curve for me.
Thank you for your time.
Try this code. I added explicit casts for the editor types
Public Class Form1 Private Sub UltraListView1_ItemEnteredEditMode(sender As Object, e As Infragistics.Win.UltraWinListView.ItemEnteredEditModeEventArgs) Handles UltraListView1.ItemEnteredEditMode ' If the embeddable editor for this item supports a dropdown, ' call the DropDown method. Dim embeddableElement As EmbeddableUIElementBase = CType(e.Item.UIElement.GetDescendant(GetType(EmbeddableUIElementBase)), EmbeddableUIElementBase) Dim editor As EmbeddableEditorBase = CType(IIf(Not embeddableElement Is Nothing, embeddableElement.Editor, Nothing), EmbeddableEditorBase) If (Not editor Is Nothing AndAlso editor.SupportsDropDown) Then editor.DropDown() End If End Sub End Class
Thank you for reply but that makes no difference you still get the same errors
If you change Dim embeddableElement As EmbeddableUIElementBase then the second line gives you an error of editor is not a member.
Look for to the next solution
Kind RegardsPaul
Another thing you can try is to remove the second parameter from the call to GetDescendent. Try this:
Private Sub UltraListView1_ItemEnteredEditMode(sender As Object, e As Infragistics.Win.UltraWinListView.ItemEnteredEditModeEventArgs) Handles UltraListView1.ItemEnteredEditMode ' If the embeddable editor for this item supports a dropdown, ' call the DropDown method. Dim embeddableElement As EmbeddableUIElementBase = e.Item.UIElement.GetDescendant(GetType(EmbeddableUIElementBase)) Dim editor As EmbeddableEditorBase = IIf(Not embeddableElement Is Nothing, embeddableElement.Editor, Nothing) If (Not editor Is Nothing AndAlso editor.SupportsDropDown) Then editor.DropDown() End If End Sub
If this works for you, I will dig into why it was written that way and possibly change it in the docs.