Dears,,
Using
SelectTypeRow SelectTypeCol SelectTypeCell
above properties how to set that user can select multiple cells but not in different columns.
for example
like below
col1 col2 col3
row1 *
row2 *
row3 *
and not like below
row1 * *
row2 * *
row3 * *
* implies cell is selected
using the selected cells collection and through for loop
i'm pasting the values from clipboard. code is as below
For i = 0 To grdData.Selected.Cells.Count - 1 If IsNumeric(Clipboard.GetData(Trim(grdData.ActiveCell.Column.DataType.ToString))) Then grdData.Selected.Cells(i).Value = Val(Clipboard.GetData(Trim(grdData.ActiveCell.Column.DataType.ToString))) Else grdData.Selected.Cells(i).Value = Clipboard.GetData(Trim(grdData.ActiveCell.Column.DataType.ToString)) End If Next
my problem is all the rows were still in edit mode
how to get rid of this problem?
OMG! i made if statement wrong
it s working
thanks
In BeforeSelectChange event i tried like this
Dim hshchk As New Hashtable For i = 0 To e.NewSelections.Cells.Count - 1 If i <> 0 And hshchk.ContainsValue(e.NewSelections.Cells(i).Column.ToString()) Then hshchk.Add(i, e.NewSelections.Cells(i).Column.ToString()) Else e.Cancel = True Exit For End If Next
but no result
Handle the BeforeSelectChange event, evaluate the e.NewSelections.Cells, and cancel the event if the selection violates whatever rules you have in effect.