I have borrowed the code provided by infragistics to make the cursor behave like excel.
The following 2 lines of code cause the error message -
Me.grdfireplace.PerformAction(UltraGridAction.ExitEditMode, False, False)Me.grdfireplace.PerformAction(UltraGridAction.BelowCell, False, False)
Unable to convert data value. Value could not be converted to system.decimal.
This occurs from the compiled program. when I am enter a 0 or a 0. or blank into a decimal field and i try to perform the lines of code. I would like to force the cells to be 0,00 and I would be good.
I believe the Keyup event occurs before the beforecellupdate or any other event I could used to intercept and correct the abnormal 0 value.
Can anybody tell me how to solve this?
I love the capability except for this issue
Arnie
The Entire subroutine follows below.
Private Sub grdfireplace_KeyDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) _
Handles grdfireplace.KeyDown
' Perform action needed to move cursor
Select Case
e.KeyValue
Case
Keys.Up
Me.grdfireplace.PerformAction(UltraGridAction.ExitEditMode, False, False)
Me.grdfireplace.PerformAction(UltraGridAction.AboveCell, False, False)
e.Handled =
True
Me.grdfireplace.PerformAction(UltraGridAction.EnterEditMode, False, False)
Keys.Down
MsgBox(
)
"2")
Me.grdfireplace.PerformAction(UltraGridAction.BelowCell, False, False)
"3")
Keys.Right
Me.grdfireplace.PerformAction(UltraGridAction.NextCellByTab, False, False)
Keys.Left
Me.grdfireplace.PerformAction(UltraGridAction.PrevCellByTab, False, False)
End Select
End Sub
You should be able to handle the BeforeExitEditMode event, and set the editor's Value to 0.00. When that event fires, the grid's ActiveCell property will be non-null, and you can get a reference to the editor via the UltraGrid.ActiveCell.EditorResolved property.