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.
Unfortunately, activation email could not send to your email. Please try again.

GC: Setting the currrent row

Thread ID:

Created:

Updated:

Platform:

Replies:

63873 Jul 11,2007 02:55 AM Jul 12,2007 04:52 PM Windows Forms 4
loading
Tags: GridControl
Richard Bysouth
Asked On July 11, 2007 02:55 AM

Hi

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.Clear(False)

m_Grid.Selections.Add(GridRangeInfo.Row(rowIndex))

m_Grid.Selections.CurrentCellInfo.RowIndex = rowIndex

End Sub


Richard Bysouth
Replied On July 11, 2007 02:57 AM

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 02:27 PM

Hi Richard,

You can try these code :

this.gridControl1.CurrentCell.MoveTo(2, 2);
this.gridControl1.Model.Selections.Add(GridRangeInfo.Row(2));

Best regards,
Haneef

Richard Bysouth
Replied On July 11, 2007 05:58 PM

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

Richard

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

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,
Haneef

CONFIRMATION

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.

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.

;