?? 外來人員記錄.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 + -