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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GC: Setting the currrent row

Thread ID:





63873 Jul 11,2007 06:55 AM UTC Jul 12,2007 08:52 PM UTC WinForms 4
Tags: GridControl
Richard Bysouth
Asked On July 11, 2007 06:55 AM UTC


Simple question:
How do I set the current selected row in a GridControl? A property such as GridControl.CurrentRow = 3 would be great. I'm using the following code but I end up with 1 row being selected and another being the current cell. Must be an easier way than this!

Public Sub SetRowAsCurrent(ByVal rowIndex As Integer)

If rowIndex < m_Grid.Rows.HeaderCount Or rowIndex > m_Grid.RowCount Then
Exit Sub
End If

'clear any selected ranges


m_Grid.Selections.CurrentCellInfo.RowIndex = rowIndex

End Sub

Richard Bysouth
Replied On July 11, 2007 06:57 AM UTC

that last line was wrong, should have been

m_Grid.CurrentCellInfo.RowIndex = rowIndex

Do I have to set both CurrentCellInfo.RowIndex AND add the row to the Selections?

I only want to select a single row!

haneefm [Syncfusion]
Replied On July 11, 2007 06:27 PM UTC

Hi Richard,

You can try these code :

this.gridControl1.CurrentCell.MoveTo(2, 2);

Best regards,

Richard Bysouth
Replied On July 11, 2007 09:58 PM UTC

thanks Haneef

Sorry to ask such simple questions, but how do I retrieve the current rowIndex?
I have tried many many properties such as CurrentCell.RowIndex, CurrentCell.MoveFromRowIndex etc. but none of these return the correct row index!

Is there some documentation somewhere outlining the differences between all of the CurrentCell/Selections/Ranges properties? Couldn't find anything in the Knowledge Base to help me

many thanks


haneefm [Syncfusion]
Replied On July 12, 2007 08:52 PM UTC

Hi Richard,

How do I retrieve the current rowIndex?

You can retrieve the current rowIndex by using the CurrentCell.RowIndex.But I am not sure of what be might be causing this strange behavior without a working sample. I have tested this issue in browser sample with Essentail studio V.4.x/5.x. But i was not able to reproduce the issue. Is it possible for you to upload us a minimal sample or modify the browser sample to reproduce the issue here? This will help us to analyse the issue further.

Best regards,


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon