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.

Selecting Cell

Thread ID:

Created:

Updated:

Platform:

Replies:

48492 Aug 29,2006 10:18 AM Aug 30,2006 09:01 AM Windows Forms 4
loading
Tags: GridControl
Mark
Asked On August 29, 2006 10:18 AM

Can someone explain to me how to select a cell programmatically? I can''t seem to find any documentation on this functionality. Thanks.

Mark

Administrator [Syncfusion]
Replied On August 29, 2006 04:09 PM

If I''m understanding what you want, I believe all you need to do is call grid.Selections.SelectRange(GridRangeInfo.Cell(rowIndex, colIndex), true) to select a single cell.

Mark
Replied On August 29, 2006 07:33 PM

If I try to do that the whole cell is selected which is not what I intend to do.

Maybe I am going about it the wrong way but what I have is an event that I capture CurrentCellActivating and what I do is set e.Cancel = true and then call the same function you just referred to but what happens is the whole cell is selected (the bahviour I want is to mimick the clicking inside of a cell to edit it). Is there something that I am doing wrong or could do differently to achieve what I want?

>If I''m understanding what you want, I believe all you need to do is call grid.Selections.SelectRange(GridRangeInfo.Cell(rowIndex, colIndex), true) to select a single cell.

Mark
Replied On August 29, 2006 08:31 PM

I finally worked out a way to do it...

Within the CurrentCellActivating I do the following;

e.Cancel = true;

Then I hooked up a handler to the event CurrentCellActivateFailed where I do the following;

gridControl1.CurrentCell.Activate(e.RowIndex, e.ColIndex - 1);


This works perfect. Thanks for your help.

>If I''m understanding what you want, I believe all you need to do is call grid.Selections.SelectRange(GridRangeInfo.Cell(rowIndex, colIndex), true) to select a single cell.

Administrator [Syncfusion]
Replied On August 30, 2006 09:01 AM

Mark,

I''m confused. You''re canceling the activation, then you''re activating the cell?

What you really might want to do is look at the GridControl.ActivateCurrentCellBehavior. There are several options for what you can have it do when it activates.

Or are you talking about selecting the all the text in the cell when you activate it? If that''s the case, then look at the GridCellActivateAction.SelectAll option.

Pete

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.

;