取得"-"之后的用户名:
http://www.foxtable.com/help/topics/1338.htm
在DataColhanging(注意不是DataColChanged)设置代码:
if e.datacol.Name = "客户名" Then
if e.NewValue > "" AndAlso e.NewValue.Indexof("-") > 0 Then
dim idx = e.NewValue.LastIndexof("-")
Dim nm As string = "'*-" * e.NewValue.SubString(idx + 1) & "'"
if e.DataTable.Find("客户名 Like " & nm) IsNot Nothing Then
e.Cancel = True
MessageBox.show(“已经存在同名客户”)
End if
end if
End if