⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 info.vb

📁 人事管理系统,用VB+SQL编译的
💻 VB
📖 第 1 页 / 共 2 页
字号:
    End Sub
    Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
        Select Case Me.ToolBar1.Buttons.IndexOf(e.Button)
            Case 0
                t = Trim(myds.Tables("useinfo").Rows(Me.BindingContext(myds.Tables("useinfo")).Position).Item(0))
                Dim a1 As New infoadd                a1.Show()            Case 1
                t = Trim(myds.Tables("useinfo").Rows(Me.BindingContext(myds.Tables("useinfo")).Position).Item(0))
                Dim a1 As New infoupdate                a1.Show()
            Case 2
                t = Trim(myds.Tables("useinfo").Rows(Me.BindingContext(myds.Tables("useinfo")).Position).Item(0))
                Dim sqlstr As String
                t = Trim(myds.Tables("useinfo").Rows(Me.BindingContext(myds.Tables("useinfo")).Position).Item(0))
                sqlstr = "select * from useinfo where 员工编号 ='" & t & "'"
                If execsql(sqlstr, "useinfo") Then
                    Dim i As Integer
                    For i = 0 To mytable.Rows.Count - 1
                        If Trim(t) = Trim(mytable.Rows(i).Item(0)) Then
                            myrow = myds.Tables("useinfo").Rows(i)
                            myrow.Delete()
                            mycmb = New SqlCommandBuilder(mydad)
                            mydad.Update(myds, "useinfo")
                            Try
                                myds.Clear()
                                mycon.Close()
                                Dim j As Integer
                                Dim sqlstr1 As String
                                sqlstr1 = "select * from userid where 帐号 ='" & t & "'"
                                If execsql(sqlstr1, "userid") Then
                                    For j = 0 To mytable.Rows.Count - 1
                                        If Trim(t) = Trim(mytable.Rows(j).Item(0)) Then
                                            myrow = myds.Tables("userid").Rows(j)
                                            myrow.Delete()
                                            mycmb = New SqlCommandBuilder(mydad)
                                            mydad.Update(myds, "userid")
                                            MsgBox("删除成功")
                                            Dim strsql As String
                                            strsql = "select * from useinfo"
                                            If Not execsql(strsql, "useinfo") Then
                                                Exit Sub
                                            Else
                                                Dim a As New info
                                                a.DataGrid1.DataSource = myds.Tables("useinfo")
                                            End If
                                            Exit Sub
                                        End If
                                    Next
                                End If
                            Catch ex As Exception
                                MsgBox("删除不成功")
                            End Try
                            Exit Sub
                        End If
                    Next
                End If
            Case 3
                Me.PrintPreviewDialog1.Document = Me.PrintDocument1
                Me.PrintPreviewDialog1.Document.DefaultPageSettings.Landscape = True
                Me.PrintPreviewDialog1.ShowDialog()
                Dim strsql As String
                strsql = "select * from useinfo"
                If Not execsql(strsql, "useinfo") Then
                    Exit Sub
                Else
                    Dim a As New info
                    a.DataGrid1.DataSource = myds.Tables("useinfo")
                End If
        End Select
    End Sub

    Private Sub DataGrid1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.Click
        t = Trim(myds.Tables("useinfo").Rows(Me.BindingContext(myds.Tables("useinfo")).Position).Item(0))
    End Sub
    Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
        Dim p(9) As Point
        Dim myb As New SolidBrush(System.Drawing.Color.Black)
        Dim myf = New Font("宋体", 15)
        Dim i As Integer
        For i = 1 To 9
            p(i) = New Point(100 + (i - 1) * 110, 100)
        Next
        Dim myp As Pen = New Pen(System.Drawing.Color.Black)
        e.Graphics.DrawLine(myp, p(1), p(9))
        For i = 1 To 9
            p(0).X = p(i).X
            p(0).Y = p(i).Y + 30
            e.Graphics.DrawLine(myp, p(i), p(0))
            p(0).Y = p(0).Y - 23
            Select Case i
                Case 1
                    e.Graphics.DrawString("员工编号", myf, myb, p(0).X, p(0).Y)
                Case 2
                    e.Graphics.DrawString("姓名", myf, myb, p(0).X, p(0).Y)
                Case 3
                    e.Graphics.DrawString("性别", myf, myb, p(0).X, p(0).Y)
                Case 4
                    e.Graphics.DrawString("籍贯", myf, myb, p(0).X, p(0).Y)
                Case 5
                    e.Graphics.DrawString("年龄", myf, myb, p(0).X, p(0).Y)
                Case 6
                    e.Graphics.DrawString("出生日期", myf, myb, p(0).X, p(0).Y)
                Case 7
                    e.Graphics.DrawString("电话", myf, myb, p(0).X, p(0).Y)
                Case 8
                    e.Graphics.DrawString("备注", myf, myb, p(0).X, p(0).Y)
            End Select
        Next
        For i = 1 To 9
            p(i).Y = p(i).Y + 30
        Next
        e.Graphics.DrawLine(myp, p(1), p(9))
        myds.Clear()
        mycon.Close()
        Dim j, k As Integer
        Dim sqlstr As String
        sqlstr = "select * from useinfo"
        If execsql(sqlstr, "useinfo") Then
            j = myds.Tables("useinfo").Rows.Count - 1
            For k = 0 To myds.Tables("useinfo").Rows.Count - 1
                For i = 1 To 9
                    p(0).X = p(i).X
                    p(0).Y = p(i).Y + 30
                    e.Graphics.DrawLine(myp, p(i), p(0))
                    p(0).Y = p(0).Y - 23
                    Select Case i
                        Case 1
                            e.Graphics.DrawString(myds.Tables("useinfo").Rows(k).Item("员工编号"), myf, myb, p(0).X, p(0).Y)
                        Case 2
                            e.Graphics.DrawString(myds.Tables("useinfo").Rows(k).Item("姓名"), myf, myb, p(0).X, p(0).Y)
                        Case 3
                            e.Graphics.DrawString(myds.Tables("useinfo").Rows(k).Item("性别"), myf, myb, p(0).X, p(0).Y)
                        Case 4
                            e.Graphics.DrawString(myds.Tables("useinfo").Rows(k).Item("籍贯"), myf, myb, p(0).X, p(0).Y)
                        Case 5
                            e.Graphics.DrawString(myds.Tables("useinfo").Rows(k).Item("年龄"), myf, myb, p(0).X, p(0).Y)
                        Case 6
                            e.Graphics.DrawString(myds.Tables("useinfo").Rows(k).Item("出生日期"), myf, myb, p(0).X, p(0).Y)
                        Case 7
                            Try
                                e.Graphics.DrawString(myds.Tables("useinfo").Rows(k).Item("电话"), myf, myb, p(0).X, p(0).Y)
                            Catch ex As Exception
                            End Try
                        Case 8
                            Try
                                e.Graphics.DrawString(myds.Tables("useinfo").Rows(k).Item("备注"), myf, myb, p(0).X, p(0).Y)
                            Catch ex As Exception
                            End Try
                    End Select
                Next
                For i = 1 To 9
                    p(i).Y = p(i).Y + 30
                Next
                e.Graphics.DrawLine(myp, p(1), p(9))
            Next
        End If
        myds.Clear()
        mycon.Close()
    End Sub
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -