We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to jump to a cell

I want to change the current cell to say col1 row 4, any ideas

Thanks
Geoff

6 Replies

PB Philip Bishop September 5, 2007 04:11 PM UTC

This following will change the current cell to row2, col2....

grdAGCY_AR.CurrentCell.MoveTo(2, 2)

This next piece of code will do the same as above and scoll the cell in view if it wasn't in view.....

grdExpires.CurrentCell.MoveTo(2, 2, GridSetCurrentCellOptions.ScrollInView)


PB Philip Bishop September 5, 2007 04:13 PM UTC

And where I had grdExpires for example this would be the name of your grid.


GP Geoff Parker September 5, 2007 05:35 PM UTC

Thanks I dont know why but I read that in the documents as moving cell contents from one place to another.

Thanks
Geoff


GP Geoff Parker September 6, 2007 07:42 AM UTC

Although the above code does work from a button it does not seem to work how I am trying to apply it.

When the user enters a value of x in column 2 I want to jump to column 5 and allow the user to type in a value in column five without clicking I have tried the below

Sub XXX() handles grid1control.currentcelleditingcomplete

curcell = grid1control.currentcell

if curcell.colindex = 2 then
if gridcontrol1(curcell.rowindex, 2) = "x"
gridcontrol1.currentcell.moveto(curcell.rowindex, 5)
End if
End If

Yhis does not move the current cell, any help welcome


PB Philip Bishop September 6, 2007 03:47 PM UTC

This worked for me

Private Sub gc1_CurrentCellChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles gc1.CurrentCellChanged
If gc1.CurrentCell.Renderer.ControlText = "x" Then
gc1.CurrentCell.MoveTo(1, 5)
End If


GP Geoff Parker September 7, 2007 10:14 AM UTC

Philip Thanks I thanks work a treat

Loader.
Live Chat Icon For mobile
Up arrow icon