-- 作者:有点甜
-- 发布时间:2017/11/24 12:09:00
--
textchanged事件
If e.Sender.text > "" Then systemready = False Dim idx As Integer = e.Sender.SelectionStart Dim fdr As DataRow = DataTables("表A").find("第一列 like \'" & e.sender.Text.SubString(0,idx) & "%\'") If fdr IsNot Nothing Then e.sender.text = fdr("第一列") e.Sender.SelectionStart = idx e.Sender.SelectionLength = e.Sender.Text.length-idx End If systemready = True End If
keydown事件
If e.KeyCode = keys.delete Then Dim idx As Integer = e.sender.SelectionStart Dim str = left(e.sender.text, idx) str &= right(e.sender.text, e.sender.text.length-idx-e.Sender.SelectionLength) Systemready = False e.sender.text = str e.sender.SelectionStart = idx Systemready = True ElseIf e.KeyCode = Keys.Back Then If e.sender.SelectionLength > 0 Then Dim idx As Integer = e.sender.SelectionStart Dim str = left(e.sender.text, idx-1) str &= right(e.sender.text, e.sender.text.length-idx-e.Sender.SelectionLength) Systemready = False e.sender.text = str If e.sender.text > "" Then e.sender.SelectionStart = idx Dim fdr As DataRow = DataTables("表A").find("第一列 like \'" & e.sender.Text & "%\'") If fdr IsNot Nothing Then e.sender.text = fdr("第一列") e.Sender.SelectionStart = str.length e.Sender.SelectionLength = e.Sender.Text.length-str.length End If End If systemready = True e.cancel = True End If End If
|