大师:我在表的ValidateEdit事件中写入如下代码,验证输入的内容,如果输入的有重复,禁止退出,同时希望输入的单元格的值恢复到原来的值,为何不行? 红色部分的设置无效,怎么解决?
If e.Row.Index = 1 Then
Dim lzf As String
lzf = e.Row(e.Col.Name)
'-------重复值检测---------------------
Dim count As Integer = 0
For Each cl As Col In e.Table.Cols
If cl.name <> e.Col.Name Then
If e.Row(cl.Name) = e.Text And e.text <> "" Then
count += 1
Exit For
End If
End If
Next
If count >= 1 Then
MessageBox.Show("标题列不能重复!确认此列标题前,请删除其他列的相同标题","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
e.Text = lzf
e.cancel = True
End If
end if