找回密码
 立即注册

QQ登录

只需一步,快速开始

barrylei
中级会员   /  发表于:2011-7-12 16:07:00
11#

使用下面的代码

  1.     Delegate Sub MyDelegate()

  2.     Private Sub MyMultirow1_CellValidating(ByVal sender As System.Object, ByVal e As GrapeCity.Win.MultiRow.CellValidatingEventArgs) 'Handles MyMultirow1.CellValidating
  3.         If e.CellName = "C1" Then
  4.             If e.FormattedValue.ToString <> "bbb" Then

  5.                 MessageBox.Show("error input")

  6.                 Dim editingControl As IEditingControl = TryCast(MyMultirow1.EditingControl, IEditingControl)

  7.                 If editingControl IsNot Nothing Then
  8.                     editingControl.FormattedValue = Nothing
  9.                 End If
  10.                 e.Cancel = True
  11.             Else
  12.                 MyMultirow1.DataSource = dtTable2
  13.                 Me.BeginInvoke(New MyDelegate(AddressOf MoveActiveCell))
  14.             End If
  15.         End If
  16.     End Sub
  17.     Private Sub MoveActiveCell()
  18.         Me.MyMultirow1.CurrentCellPosition = New CellPosition(Me.MyMultirow1.CurrentCell.RowIndex, "C2")

  19.     End Sub
复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 使用道具 举报
chenf1980
论坛元老   /  发表于:2011-7-12 16:17:00
12#
谢谢,原来需要 Me.BeginInvoke(New MyDelegate(AddressOf MoveActiveCell))
这个方法来执行才对啊
回复 使用道具 举报
barrylei
中级会员   /  发表于:2011-7-12 17:06:00
13#
:-)
回复 使用道具 举报
12
您需要登录后才可以回帖 登录 | 立即注册
返回顶部