📄 外来人员记录.vb
字号:
'
Me.Label15.AutoSize = True
Me.Label15.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label15.Location = New System.Drawing.Point(8, 136)
Me.Label15.Name = "Label15"
Me.Label15.Size = New System.Drawing.Size(80, 22)
Me.Label15.TabIndex = 29
Me.Label15.Text = "离开时间:"
'
'Label16
'
Me.Label16.AutoSize = True
Me.Label16.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label16.Location = New System.Drawing.Point(192, 40)
Me.Label16.Name = "Label16"
Me.Label16.Size = New System.Drawing.Size(63, 22)
Me.Label16.TabIndex = 28
Me.Label16.Text = "被访者:"
'
'Label17
'
Me.Label17.AutoSize = True
Me.Label17.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label17.Location = New System.Drawing.Point(192, 144)
Me.Label17.Name = "Label17"
Me.Label17.Size = New System.Drawing.Size(64, 22)
Me.Label17.TabIndex = 27
Me.Label17.Text = "关 系:"
'
'Label18
'
Me.Label18.AutoSize = True
Me.Label18.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label18.Location = New System.Drawing.Point(8, 104)
Me.Label18.Name = "Label18"
Me.Label18.Size = New System.Drawing.Size(80, 22)
Me.Label18.TabIndex = 26
Me.Label18.Text = "来访时间:"
'
'Label19
'
Me.Label19.AutoSize = True
Me.Label19.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label19.Location = New System.Drawing.Point(8, 72)
Me.Label19.Name = "Label19"
Me.Label19.Size = New System.Drawing.Size(80, 22)
Me.Label19.TabIndex = 25
Me.Label19.Text = "身份证号:"
'
'Label20
'
Me.Label20.AutoSize = True
Me.Label20.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label20.Location = New System.Drawing.Point(8, 40)
Me.Label20.Name = "Label20"
Me.Label20.Size = New System.Drawing.Size(80, 22)
Me.Label20.TabIndex = 24
Me.Label20.Text = "来 访 者:"
'
'外来人员记录
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.BackColor = System.Drawing.Color.Silver
Me.ClientSize = New System.Drawing.Size(784, 478)
Me.Controls.Add(Me.Panel2)
Me.Controls.Add(Me.Panel1)
Me.Controls.Add(Me.DataGrid1)
Me.Name = "外来人员记录"
Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
Me.Text = "外来人员记录"
CType(Me.DataGrid1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.Da1, System.ComponentModel.ISupportInitialize).EndInit()
Me.Panel1.ResumeLayout(False)
Me.Panel2.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub 外来人员记录_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
OleDbDataAdapter1.SelectCommand.CommandText = "select * from 外来人员记录"
Da1.Clear()
OleDbDataAdapter1.Fill(Da1)
Me.DataGrid1.Select(DataGrid1.CurrentRowIndex)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
If Button1.Text = "添加" Then
Me.BindingContext(Da1, "外来人员记录").AddNew()
Button1.Text = "确定"
Button2.Enabled = False
Button3.Enabled = False
Button8.Enabled = False
Button9.Enabled = False
Button10.Enabled = False
Button11.Enabled = False
Else
If Button1.Text <> "确定" Then
Exit Sub
End If
Me.BindingContext(Da1, "外来人员记录").EndCurrentEdit()
OleDbDataAdapter1.Update(Da1.外来人员记录)
MsgBox("添加成功!")
Button1.Text = "添加"
Button2.Enabled = True
Button3.Enabled = True
Button8.Enabled = True
Button9.Enabled = True
Button10.Enabled = True
Button11.Enabled = True
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Try
If MsgBox("你真的要删除此记录吗?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
Me.BindingContext(Da1, "外来人员记录").EndCurrentEdit()
OleDbDataAdapter1.Update(Da1.外来人员记录)
Else
Exit Sub
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Try
Me.BindingContext(Da1, "外来人员记录").EndCurrentEdit()
OleDbDataAdapter1.Update(Da1.外来人员记录)
MsgBox("更改成功!")
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Me.BindingContext(Da1, "外来人员记录").CancelCurrentEdit()
Button1.Text = "添加"
Button2.Enabled = True
Button3.Enabled = True
Button8.Enabled = True
Button9.Enabled = True
Button10.Enabled = True
Button11.Enabled = True
End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
Try
OleDbDataAdapter1.SelectCommand.CommandText = "select * from 外来人员记录"
Da1.Clear()
OleDbDataAdapter1.Fill(Da1)
Me.DataGrid1.Select(DataGrid1.CurrentRowIndex)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
Try
OleDbDataAdapter1.SelectCommand.CommandText = "select * from 外来人员记录"
Da1.Clear()
OleDbDataAdapter1.Fill(Da1)
Me.DataGrid1.Select(DataGrid1.CurrentRowIndex)
Catch ex As Exception
MsgBox(ex.Message)
End Try
TextBox10.Text = ""
TextBox11.Text = ""
TextBox12.Text = ""
TextBox13.Text = ""
TextBox14.Text = ""
TextBox15.Text = ""
TextBox16.Text = ""
TextBox17.Text = ""
TextBox18.Text = ""
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Try
Dim ComStr As String
ComStr = "select * from 外来人员记录 where"
ComStr &= " 来访者姓名 like '" & "%" & Trim(TextBox18.Text) & "%'"
ComStr &= "and 身份证号码 like '" & Trim(TextBox16.Text) & "%'"
ComStr &= "and 来访时间 like '%" & Trim(TextBox14.Text) & "%'"
If Trim(TextBox12.Text) <> "" Then
ComStr &= "and 离开时间 like '%" & Trim(TextBox12.Text) & "%'"
End If
ComStr &= "and 被访者姓名 like '" & "%" & Trim(TextBox17.Text) & "%" & "'"
ComStr &= "and 被访者栋号 like '%" & Trim(TextBox15.Text) & "%'"
ComStr &= "and 被访者房号 like '" & Trim(TextBox13.Text) & "%" & "'"
ComStr &= "and 关系 like '" & "%" & Trim(TextBox11.Text) & "%" & "'"
If Trim(TextBox10.Text) <> "" Then
ComStr &= "and 备注 like '%" & Trim(TextBox10.Text) & "%'"
End If
OleDbDataAdapter1.SelectCommand.CommandText = ComStr
Da1.Clear()
OleDbDataAdapter1.Fill(Da1)
Me.DataGrid1.Select(DataGrid1.CurrentRowIndex)
Catch ex As Exception
MsgBox("没有您要查询的数据!")
End Try
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
Me.Close()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -