使用下面的代码
- Delegate Sub MyDelegate()
- Private Sub MyMultirow1_CellValidating(ByVal sender As System.Object, ByVal e As GrapeCity.Win.MultiRow.CellValidatingEventArgs) 'Handles MyMultirow1.CellValidating
- If e.CellName = "C1" Then
- If e.FormattedValue.ToString <> "bbb" Then
- MessageBox.Show("error input")
- Dim editingControl As IEditingControl = TryCast(MyMultirow1.EditingControl, IEditingControl)
- If editingControl IsNot Nothing Then
- editingControl.FormattedValue = Nothing
- End If
- e.Cancel = True
- Else
- MyMultirow1.DataSource = dtTable2
- Me.BeginInvoke(New MyDelegate(AddressOf MoveActiveCell))
- End If
- End If
- End Sub
- Private Sub MoveActiveCell()
- Me.MyMultirow1.CurrentCellPosition = New CellPosition(Me.MyMultirow1.CurrentCell.RowIndex, "C2")
- End Sub
复制代码 |