Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27033

VS 2010 Limiting DataGridView Multiselect to only 1 column

$
0
0
Working with a DataGridView with the SelectionMode set to RowHeaderSelect.

I want the user to be able to multiselect cells but only within the same column. If they try to select values outside the original column, they won't select.

I thought one way to do this might be within the SelectionChanged event, unselecting cells that aren't in the same column...

I tried this, but it didn't really work...
.net Code:
  1. For Each cell In CueDGV.SelectedCells
  2.       If cell.columnindex <> CueDGV.CurrentCell.ColumnIndex Then
  3.       CueDGV.CurrentCell.Selected = False
  4.    End If
  5. Next
Is there a simple way to only allow multiselect within the same column?

Viewing all articles
Browse latest Browse all 27033

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>