📄 infoadd.vb
字号:
Me.Label15.Location = New System.Drawing.Point(32, 80)
Me.Label15.Name = "Label15"
Me.Label15.Size = New System.Drawing.Size(66, 17)
Me.Label15.TabIndex = 21
Me.Label15.Text = "与本人关系"
'
'Label18
'
Me.Label18.AutoSize = True
Me.Label18.BackColor = System.Drawing.Color.Transparent
Me.Label18.Location = New System.Drawing.Point(224, 80)
Me.Label18.Name = "Label18"
Me.Label18.Size = New System.Drawing.Size(54, 17)
Me.Label18.TabIndex = 25
Me.Label18.Text = "政治面貌"
'
'TextBox12
'
Me.TextBox12.Location = New System.Drawing.Point(296, 80)
Me.TextBox12.Name = "TextBox12"
Me.TextBox12.Size = New System.Drawing.Size(88, 21)
Me.TextBox12.TabIndex = 32
Me.TextBox12.Text = ""
'
'TextBox13
'
Me.TextBox13.Location = New System.Drawing.Point(104, 80)
Me.TextBox13.Name = "TextBox13"
Me.TextBox13.Size = New System.Drawing.Size(88, 21)
Me.TextBox13.TabIndex = 27
Me.TextBox13.Text = ""
'
'Label19
'
Me.Label19.AutoSize = True
Me.Label19.BackColor = System.Drawing.Color.Transparent
Me.Label19.Location = New System.Drawing.Point(32, 152)
Me.Label19.Name = "Label19"
Me.Label19.Size = New System.Drawing.Size(29, 17)
Me.Label19.TabIndex = 24
Me.Label19.Text = "单位"
'
'TextBox14
'
Me.TextBox14.Location = New System.Drawing.Point(104, 152)
Me.TextBox14.Name = "TextBox14"
Me.TextBox14.Size = New System.Drawing.Size(288, 21)
Me.TextBox14.TabIndex = 28
Me.TextBox14.Text = ""
'
'Label20
'
Me.Label20.AutoSize = True
Me.Label20.BackColor = System.Drawing.Color.Transparent
Me.Label20.Location = New System.Drawing.Point(32, 112)
Me.Label20.Name = "Label20"
Me.Label20.Size = New System.Drawing.Size(29, 17)
Me.Label20.TabIndex = 23
Me.Label20.Text = "电话"
'
'TextBox15
'
Me.TextBox15.Location = New System.Drawing.Point(104, 112)
Me.TextBox15.Name = "TextBox15"
Me.TextBox15.Size = New System.Drawing.Size(128, 21)
Me.TextBox15.TabIndex = 30
Me.TextBox15.Text = ""
'
'ImageList1
'
Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16)
Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
'
'infoadd
'
Me.AutoScaleBaseSize = New System.Drawing.Size(7, 14)
Me.ClientSize = New System.Drawing.Size(496, 429)
Me.Controls.Add(Me.TabControl1)
Me.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.Name = "infoadd"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "添加员工信息"
Me.TabControl1.ResumeLayout(False)
Me.TabPage1.ResumeLayout(False)
Me.GroupBox1.ResumeLayout(False)
Me.TabPage2.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Dim strsql As String
Private Sub infoadd_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
myds.Clear()
GroupBox1.Enabled = False
TextBox3.Enabled = False
TextBox4.Enabled = False
Button1.Enabled = False
Button2.Enabled = False
Button6.Enabled = False
myds.Clear()
mycon.Close()
Dim strsql1 As String
strsql1 = "select * from useinfo"
If Not execsql(strsql1, "useinfo") Then
Exit Sub
Else
Dim a As New info
a.DataGrid1.DataSource = myds.Tables("useinfo")
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If Not IsNumeric(TextBox8.Text) Then
MsgBox("您输入的年龄不符,请重新输入数字")
TextBox8.Text = ""
Exit Sub
End If
If TextBox6.Text = "" Or ComboBox1.Text = "" Or DateTimePicker1.Text = "" Or TextBox7.Text = "" Then
MsgBox("输入不完整!")
Else
strsql = "select * from useinfo"
execsql(strsql, "useinfo")
myrow = myds.Tables("useinfo").NewRow
myrow("员工编号") = Me.Label21.Text
myrow("姓名") = Me.TextBox6.Text
myrow("性别") = Me.ComboBox1.Text
myrow("籍贯") = Me.TextBox7.Text
myrow("出生日期") = DateTimePicker1.Text
myrow("年龄") = Me.TextBox8.Text
myrow("电话") = Me.TextBox9.Text
myrow("备注") = Me.RichTextBox1.Text
myds.Tables("useinfo").Rows.Add(myrow)
mycmb = New SqlCommandBuilder(mydad)
mydad.Update(myds, "useinfo")
mycon.Close()
MsgBox("恭喜你!添加基本信息成功")
Button2.Enabled = False
GroupBox1.Enabled = False
Button3.Enabled = True
End If
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim sql As String
sql = "select * from userid where 帐号='" & TextBox1.Text & "'" If execsql(sql, "userid") Then
Dim i As Integer
For i = 0 To myds.Tables("userid").Rows.Count - 1
If Trim(TextBox1.Text) = Trim(myds.Tables("userid").Rows(i).Item(0)) Then
Exit For
End If
Next
If TextBox11.Text = "" Or TextBox12.Text = "" Or TextBox13.Text = "" Or TextBox14.Text = "" Then
MsgBox("输入不完整!")
Else
myds.Clear()
mycon.Close()
strsql = "select * from guanxi"
execsql(strsql, "guanxi")
myrow = myds.Tables("guanxi").NewRow
myrow("员工编号") = Me.TextBox1.Text
myrow("关系人") = Me.TextBox11.Text
myrow("与本人关系") = Me.TextBox13.Text
myrow("政治面貌") = Me.TextBox12.Text
myrow("电话") = Me.TextBox15.Text
myrow("单位") = Me.TextBox14.Text
myrow("备注") = Me.RichTextBox1.Text
myds.Tables("guanxi").Rows.Add(myrow)
mycmb = New SqlCommandBuilder(mydad)
mydad.Update(myds, "guanxi")
MsgBox("恭喜你!添加社会关系成功")
myds.Clear()
mycon.Close()
End If
Dim strsql1 As String
strsql1 = "select * from useinfo"
If Not execsql(strsql1, "useinfo") Then
Exit Sub
Else
Dim a As New info
a.DataGrid1.DataSource = myds.Tables("useinfo")
End If
Else
MsgBox("输入的用户名不存在")
Exit Sub
End If
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
strsql = "select * from userid"
execsql(strsql, "userid")
Dim i As Integer
For i = 0 To myds.Tables("userid").Rows.Count - 1
If Trim(mytable.Rows(i).Item(2)) = "2" Then
Exit For
End If
Next
If mytable.Rows.Count = 1 Then
Me.Label22.Text = Format(1, "000")
Else
Me.Label22.Text = Format(myds.Tables("userid").Rows(i - 1).Item("帐号") + 1, "000")
End If
TextBox3.Enabled = True
TextBox4.Enabled = True
Button3.Enabled = False
Button2.Enabled = False
Button1.Enabled = True
Button6.Enabled = True
TextBox3.Text = ""
TextBox4.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
Me.RichTextBox1.Text = ""
ComboBox1.Text = ""
DateTimePicker1.Text = ""
Label21.Text = ""
Dim strsql1 As String
strsql = "select * from useinfo"
execsql(strsql1, "useinfo")
Dim a As New info
a.DataGrid1.DataSource = myds.Tables("useinfo")
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Me.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox3.Text = "" Then
MsgBox("输入不完整!")
Else
If TextBox3.Text <> TextBox4.Text Then
MsgBox("输入的新密码不一致!")
TextBox3.Clear()
TextBox4.Clear()
TextBox3.Focus()
Exit Sub
Else
strsql = "select * from userid"
execsql(strsql, "userid")
myrow = myds.Tables("userid").NewRow
myrow("帐号") = Me.Label22.Text
myrow("密码") = Me.TextBox3.Text
myrow("权限") = Me.TextBox2.Text
myds.Tables("userid").Rows.Add(myrow)
mycmb = New SqlCommandBuilder(mydad)
mydad.Update(myds, "userid")
mycon.Close()
GroupBox1.Enabled = True
TextBox3.Enabled = False
TextBox4.Enabled = False
Button1.Enabled = False
Button2.Enabled = True
Me.Label21.Text = Label22.Text
End If
End If
Me.Label6.Focus()
myds.Clear()
mycon.Close()
Dim strsql1 As String
strsql1 = "select * from useinfo"
If Not execsql(strsql1, "useinfo") Then
Exit Sub
Else
Dim a As New info
a.DataGrid1.DataSource = myds.Tables("useinfo")
End If
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Me.TextBox6.Clear()
Me.TextBox7.Clear()
Me.TextBox8.Clear()
Me.TextBox9.Clear()
Me.RichTextBox1.Clear()
Me.ComboBox1.Text = ""
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -