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

ExcelLikeCurrentCell & ExcelLikeSelectionFrame & grid.selections.count

Thread ID:

Created:

Updated:

Platform:

Replies:

13353 Apr 27,2004 10:59 AM UTC Apr 28,2004 02:53 PM UTC WinForms 5
loading
Tags: GridControl
Philip Bishop
Asked On April 27, 2004 10:59 AM UTC

I found on ur forum once that if u wanted to tell if u have more then one cell selected that u could use the grid.selections.count property for this. I only want the user to be able to go to another form by either double clicking the cell or a button but only if they have JUST ONE cell selected. So in the past I checked the grid.selections.count and if only one cell was selected it would return a zero. if you selected say 2 cells in one range it would return a one and i would know they had some sort of a range. if they selected 2 cells not in a range it would return a 2. so i figured out as long as it was zero there was only one cell. so this worked fine until we decided to turn on the ExcelLikeCurrentCell & ExcelLikeSelectionFrame. When that is on and when u selected ONE cell the selections count is now one? So this is where I am confused. Should it of always been one? Was this wrong and is now corrected? The big one to me is why is this different if these 2 properties are set to true or false? Maybe there is another way I can check for just one cell being checked but this was working great but now after turning those to properties to true it doesnt act the same?? Again now if i select 2 cells in a range with those properties set to true it returns 1 which i would assume is is correct but again why is it diff when these are set to false. I think there is some sort of a bug here and also think now I am going about trying to figure if more then one cell, range or not, has been selected..I have attached a sample. Select one cell one grid and push its button and look at the text box which is the count and do the same for the other grid. Thanx Phil selections.count_9396.zip

Administrator [Syncfusion]
Replied On April 27, 2004 03:10 PM UTC

Hi Phil, This is by design. If you have ExcelLikeCurrentCell & ExcelLikeSelectionFrame set to true, the grid will consider the current cell to be selected. If you want the consistent behavior like the ExcelLikeCurrentCell is set to false, you can check whether the selection has only the currentcell and can decrement the count by 1 to handle this case. Here is some code snippet. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click TextBox1.Text = (GridControl1.Selections.Count).ToString() If (GridControl1.Selections.Count = 1) Then Dim range As GridRangeInfo = New GridRangeInfo range = GridRangeInfo.Cell(Me.GridControl1.CurrentCell.RowIndex, Me.GridControl1.CurrentCell.ColIndex) If (Me.GridControl1.Selections.Ranges.ActiveRange.Equals(range)) Then TextBox1.Text = (GridControl1.Selections.Count - 1).ToString() End If End If End Sub Attached is the sample. Thanks. Jay N selections.count_2975.zip

Philip Bishop
Replied On April 27, 2004 03:35 PM UTC

am i doing this right in the first place??is this the best way to tell that ONLY 1 cell is selected..Not one range, just ONE CELL . I just want to know that there is eithe r ONE cell selected or more then one cells selected, ranges or not

Administrator [Syncfusion]
Replied On April 27, 2004 11:09 PM UTC

Hi Phil, The currentcell will not be a part of the selection when the ExcelLikecurrentcell is set to false. The selectioncount will be zero in this so you can rely on this approach. Regards, Jay N

Philip Bishop
Replied On April 28, 2004 10:31 AM UTC

i think i''m not explaining myself well enough. i want the excel properties set to TRUE. so i asked is this the only way to tell if one cell is selected like u gave me in that sample or is there an easier way

Administrator [Syncfusion]
Replied On April 28, 2004 02:53 PM UTC

Hi Phil, This is the way to tell whether one cell is selected. The code just checks whether the current cell is in the selected range. Regards, Jay N

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.

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

;