2

How to know if the user has done single selection of row and multiple selection of rows. I use the following code:

if(grdSearch.Row==grdSearch.RowSel)
{
    MessageBox.Show("single row selected");
}
else
{
    MessageBox.Show("multiple row selected");
}

but this only works if the user do drag and drop selection using mouse. but when the user select using CTRL key then RowSel and Row are same value. How to differentiate between single selection and multiple selection by the user.

SimpleVar
  • 14,044
  • 4
  • 38
  • 60
user3201928
  • 378
  • 1
  • 6
  • 23
  • [This](http://our.componentone.com/groups/topic/multiple-row-selection-4/) could be useful – SimpleVar Oct 22 '15 at 10:45
  • yes i am working with similar function, finding difference between multiple selection and single selection will save lots of looping and increase efficiency. – user3201928 Oct 22 '15 at 11:09

1 Answers1

1

I know this is for VB, but it may help someone searching for this similar thing. I have a boolean column in column 0, so by allowing the user to check each box, they're setting the value to -1. This script loops through the entire record set and creates a string of values from column 3 so I can insert it into my SQL Query.

Dim list As String = ""

        For Each row As C1.Win.C1FlexGrid.Row In flexgrid.Rows
        If flexgrid.GetData(row.Index, 0) = -1 Then
            If list <> vbNullString Then list = list & ", "
                list = list & "'"
                list = list & flexgrid.GetData(row.Index, 3)
                list = list & "'"
        End If
    Next
Jeff Beagley
  • 945
  • 9
  • 19