Hi,
I am using infragistic 14.2 . In ultra grid i set data using data source. in that i want one column is editable.
i set following property for it.
With UGridQueue.DisplayLayout.Bands(0) .Columns("Memo Carat Price").DataType = GetType(System.Double) .Columns("Memo Carat Price").Format = "#,##0.00;(#,##0.00)" .Columns("Memo Carat Price").MaskInput = "{LOC}nn,nnn,nnn.nn" .Columns("Memo Carat Price").PromptChar = ""
End With
its working fine.
but i want navigation on key up and down
so i written following code on
Private Sub UGridQueue_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles UGridQueue.KeyUp
Case Keys.Up ' ugriddll4.fn_UGridKeyMovements(UGridQueue, e) If UGridQueue.ActiveRow.Cells("Total Memo Price").IsActiveCell Then If UGridQueue.ActiveRow.Index <> (UGridQueue.Rows.Count - 1) Then If Len(IIf(IsDBNull(UGridQueue.Rows(UGridQueue.ActiveRow.Index - 1).Cells("LotName").Value), "", UGridQueue.Rows(UGridQueue.ActiveRow.Index - 1).Cells("LotName").Value)) > 0 Then UGridQueue.PerformAction(UltraGridAction.PrevRow) UGridQueue.ActiveRow.Cells("Total Memo Price").Activate() UGridQueue.PerformAction(UltraGridAction.EnterEditMode) Else
End If
end sub
so using above code i can move next cell/previous cell on key up/down
but when i press key up/down values get increment by 1 and then go to the next cell.
For. Eg . carat price 3200.01 when press key up it becomes 3200.02 and go to next cell
so please help me that how can i restrict it.i dont want to be change the value on key up/down
Hi Poonam,
Thank you for the contacting Infragistics Developer Support.
What you could do in order to prevent this behavior is to remove the KeyActionMappings which are causing it. This way you can use your code and it won’t increment the values in the cell. In order to do this you could use the following code:
Dim mappings = UltraGrid1.KeyActionMappings.Cast(Of GridKeyActionMapping)(). Where(Function(m) (m.KeyCode = Keys.Up Or m.KeyCode = Keys.Down) _ And (m.ActionCode = UltraGridAction.AboveCell Or m.ActionCode = UltraGridAction.BelowCell)).ToList() For Each mapping In mappings UltraGrid1.KeyActionMappings.Remove(mapping) Next
Where(Function(m) (m.KeyCode = Keys.Up Or m.KeyCode = Keys.Down) _
And (m.ActionCode = UltraGridAction.AboveCell Or m.ActionCode = UltraGridAction.BelowCell)).ToList()
For Each mapping In mappings
UltraGrid1.KeyActionMappings.Remove(mapping)
Next
For more information on KeyActionMappings please visit this link:
http://help.infragistics.com/Doc/WinForms/2014.1/CLR4.0/?page=Infragistics4.Win.UltraWinGrid.v14.1~Infragistics.Win.UltraWinGrid.UltraGrid~KeyActionMappings.html
I have attached a sample in order to demonstrate this.
Let me know if you have any additional questions.
Am working with Infragistics 13.2 for winforms and the example in the zip file didn't work for me.The removal of Grid KeyActionMappings didn't work for me.I commented out the code of Grid KeyActionMappings removal and still none of the int/double/ fields didn't increment/decrement the values on UP/DOWN key press.
But in my case i just handled the UltraGrid.KeyDown and set the following code and the increment/decrement stopped.
If ugMain.ActiveRow.Cells("COLUMN_KEY").IsActiveCell Then
If {Keys.Up, Keys.Down}.Contains(e.KeyCode) Then e.Handled = true
End IfEnd if