Ok Mike, I have another one for you...
I'm trying to activate a cell in code. I'm using the following line:
Private Sub UltraGrid1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles UltraGrid1.KeyDown Dim row As Infragistics.Win.UltraWinGrid.UltraGridRow = UltraGrid1.ActiveRow Dim cel As Infragistics.Win.UltraWinGrid.UltraGridCell = UltraGrid1.ActiveCell
If e.KeyCode = Keys.Tab Then If cel IsNot Nothing AndAlso cel.Column.Key = "PctDn" Then If row.HasNextSibling Then row.GetSibling(Infragistics.Win.UltraWinGrid.SiblingRow.Next).Cells("AdjustedValueDisplay").Activate() Else row.GetSibling(Infragistics.Win.UltraWinGrid.SiblingRow.First).Cells("AdjustedValueDisplay").Activate() End If End If End If End Sub
What I'm trying to do is make it so if they tab on the last cell of the row ("PctDn") that it'll jump to the 3rd cell in the next row ("AdjustedValueDisplay"). Instead, however, it jumps to the cell following the cell I am specifying. I can hack this by just naming the preceding column, but that's just that... a hack. I would like to know the proper way to do this. I have a feeling I need to cancel an event somewhere, as it's obviously going to the cell I specify, but then automatically being thrown to the next row, and I have no code that would do that.
Any thoughts?
Thanks!
Rocky
Ahh, e.handled... didn't see that one. Thanks, I was able to get the desired effect with that tidbit of info.
I do hope Mike is ok or is having fun on vacation, as sickness or vacation are surely the only two things that could keep him from his morning forum replies!
p.s. I kid about Mike of cousre, I've just never had anyone else reply to my posts!
What is probably happening is, the default key action for tab key is being performed along with the code you have in the KeyDown event, since you aren't setting the Handled property of the event arguments to true. If you do that, the grid will forego the action mapped for that key, thus preventing the 'NextCellByTab' action from being performed. Another solution to the problem is to remove that mapping from the KeyActionMappings collection.