调试技巧:http://www.foxtable.com/webhelp/scr/1485.htm
Dim msg As String = e.Message
msgbox(msg)
If msg.StartsWith("?#") AndAlso msg.EndsWith("#?") Then '收到请求编辑信号
Dim Key As String = msg.SubString(2,msg.Length - 4)
msgbox(Key)
msgbox(tbrk.Containskey(Key))
If tbrk.Containskey(Key) = False Then '如果无人编辑此行
tbrk.Add(Key,e.UserName) '登记申请者为此行的编辑者
e.ReturnValue = "OK" '通知申请者可以编辑
ElseIf tbrk(Key) = e.UserName Then '如果申请者就是之前登记的编辑者
e.ReturnValue = "OK" '通知申请者可以编辑
Else '如果之前登记的编辑者为其他人
e.ReturnValue = tbrk(Key) & "正在编辑此行!" '告知申请者是谁在编辑此行
End If
ElseIf msg.StartsWith("!#") AndAlso msg.EndsWith("#!") Then '收到结束编辑信号
Dim Key As String = msg.SubString(2,msg.Length - 4)
msgbox(Key)
msgbox(tbrk.Containskey(Key))
If tbrk.Containskey(Key) Then
tbrk.Remove(Key) '从集合中移除此行的编辑登记
End If
End If