最近埋头啃帮助,这是我通过帮助倒腾了一个删除重复项的条件,
虽然有点简陋,但是也达到了起码的效果。
不过,还是希望各位大大指点指点,
有没有一个比较精炼的代码。。能够实现。
先谢谢了!
代码如下:(附件也有)
TextBox1_KeyDown
Dim tbl As Table = Tables("窗口1_Table1")
Dim tm As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1")
Dim txt As WinForm.TextBox = e.Form.Controls("TextBox4")
If e.KeyCode = Keys.Up Then
tbl.Position = tbl.Position - 1
e.Cancel = True
ElseIf e.KeyCode = Keys.Down Then
tbl.Position = tbl.Position + 1
e.Cancel = True
ElseIf e.KeyCode = Keys.Enter Then
If tm.value Is Nothing Then
MessageBox.show("你还没有选择录入条件!", "提示")
Else If txt.value Is Nothing Then
MessageBox.show("你还没有选择录入条件!", "提示")
Else If tm.value IsNot Nothing Or txt.value IsNot Nothing Then
Dim r As Row = Tables("培训表").Rows.AddNew()
If tbl.Current IsNot Nothing Then
r("姓名") = tbl.Current("姓名")
r("职位") = tbl.Current("职位")
r("人员编号") = tbl.Current("人员编号")
End If
With Forms("窗口1").Controls("textbox1")
Forms("窗口1").Controls("TextBox1").Selectall()
End With
e.Cancel = True
End If
End If
表A_DataColChanged
Select Case e.DataCol.Name
Case "人员编号"
Dim drs As List(of DataRow)
drs = e.DataTable.Select("人员编号 = '" & e.DataRow("人员编号") & "' ")
If drs.Count > 1 Then
MessageBox.show("当前信息已存在!")
Tables("表A").Current.Delete
End If
End Select
TextBox1_TextChanged
Dim txt As String = e.Form.Controls("TextBox1").Text
Dim tbl As Table = Tables("窗口1_Table1")
If txt = "" Then
tbl.Filter = ""
Else
txt = "'" & txt & "*'"
tbl.Filter = "人员编号 Like " & txt
End If