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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Set Currentcell!

Thread ID:





10097 Jan 22,2004 09:47 AM UTC Apr 6,2004 11:40 AM UTC WinForms 5
Tags: GridControl
Boris Jansen
Asked On January 22, 2004 09:47 AM UTC

want to set the currentcell! at the moment the grid.currentcell.rowindex or colindex are -1 now i want to set rowindex = 2 and colindex =5 any idea?

Administrator [Syncfusion]
Replied On January 22, 2004 12:50 PM UTC

this.grid.CurrentCell.MoveTo(5,2); If you are trying the in formload, you also may have to set this.grid.ForceCurrentCellMoveTo = true;

Philip Bishop
Replied On April 6, 2004 10:03 AM UTC

I have a question similar to this. I have attached a sample where the user clicks a button where it ends the edit of the cell. Then if the user clicks another cell, the first cell they selected stays highlighted. It has to do with the celldrawn even that u had us add to let the cell stay selected when a user clicks a button and thats fine. I want to know how to make it so when the user clicks another cell that the first cell becomes unselected. SelectText_8867.zip

Administrator [Syncfusion]
Replied On April 6, 2004 11:13 AM UTC

One way you can do it is to refresh the old cell after drawing the rectangle over the new cell.
Private oldRow As Integer = -1
Private oldCol As Integer = -1

Private Sub Grid1_CellDrawn(ByVal sender As Object, ByVal e As GridDrawCellEventArgs) Handles Grid1.CellDrawn
Dim cc As GridCurrentCell = Me.Grid1.CurrentCell
If e.ColIndex = cc.ColIndex AndAlso e.RowIndex = cc.RowIndex AndAlso Not Me.Grid1.PrintingMode Then
       Dim brush As New SolidBrush(Me.Grid1.AlphaBlendSelectionColor)
                e.Graphics.FillRectangle(brush, e.Bounds)
            End Try
            If oldRow > -1 And oldCol > -1 And (oldRow <> e.RowIndex Or oldCol <> e.ColIndex) Then
                Grid1.RefreshRange(GridRangeInfo.Cell(oldRow, oldCol))
            End If
            oldRow = e.RowIndex
            oldCol = e.ColIndex
        End If
  End Sub

Philip Bishop
Replied On April 6, 2004 11:36 AM UTC

Clay, Once again thanx for the prompt response but arent you suppose to be on vacation?? Anyway that works but what does the -1 do on those 2 variables you set up?? Phil

Philip Bishop
Replied On April 6, 2004 11:40 AM UTC

Hey i figured that out. Thanks


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

This page will automatically be redirected to the 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

Live Chat Icon For mobile
Live Chat Icon