I have some code in a DoubleClick event. I want to automatically call that event when the user enters another grid cell. So I am doing the following in the AfterCellActivate event
Grid_DoubleClick(Me, Infragistics.Win.UltraWinGrid.DoubleClickCellEventArgs.Empty)
However, when this code is executed, I get the following error message:
Unable to cast object of type "System.EventArgs" to "Infragistics.Win.UltraWinGrid.DoubleClickCellEventArgs".
I don't understand this error message. First, I'm not sending a System.EventsArg. Second, the signature for the DoubleClick event requires the Infragistics.Win.UltraWinGrid.DoubleClickCellEventArgs which I'm sending.
So why am I getting this error message.
Thanks
Hi sch,
I have constructed a sample to investigate this behavior with the proper context; however, I have been unsuccessful in producing the behavior that you have described.
The behavior that I am observing is in fact exactly as would be expected, wherein the DoubleClick event is triggered whenever the user selects another cell or double clicks on the grid’s surface.
I have attached the sample that I have created for investigating this issue, please take a look to ensure that your code mirrors that in the sample.
If you are still experiencing this issue after reviewing the sample and/or modifying your code if it was needed at all, I would gladly take a look at your project; if you are able to provide a sample that I may review.
If you have any further questions regarding this issue, please let me know.
Sincerely,Chris KDeveloper Support EngineerInfragistics, Inc.www.infragistics.com/support
Hi Chris
I posted my version of the problem a few days ago. So far I haven't heard anything. Any resolution to my issue?
I have determined that you will be able to produce the behavior that you are expecting by triggering the UltraGrid_DoubleClick event within the AfterCellActivate event handler.
Example:
Private Sub UltraGrid1_AfterCellActivate(sender As System.Object, e As System.EventArgs) Handles UltraGrid1.AfterCellActivate
Dim Col As String = sender.ActiveCell.Column.Key If Col = "Qty" Then UltraGrid1_DoubleClick(Me, Infragistics.Win.UltraWinGrid.DoubleClickCellEventArgs.Empty) End If
End Sub
Private Sub UltraGrid1_DoubleClick(sender As System.Object, e As System.EventArgs) Handles UltraGrid1.DoubleClick MessageBox.Show("DoubleClick") End Sub
If needed, you may pass in a check to ensure that the element clicked on is in fact an UltraGridCell before executing your code.
I have verified that triggering the UltraGrid_DoubleClickCell event explicitly, programmatically does in fact result in a failed cast exception and I am touching base with my development team to have this issue reviewed.
If you have any further questions at all regarding this alternate approach, please let me know.