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

📄 variable.vb

📁 vb2005人事管理系统源码
💻 VB
字号:
Module Variable

    Public User As ClsUser
    Public MyDep As New ClsDepartment
    Public CurDep As New ClsDepartment
    Public MyEmp As New ClsEmployees
    Public CurEmp As New ClsEmployees '当前员工信息
    Public MyExp As New ClsExperience
    Public MyFam As New ClsFamilyMember
    Public UpperEmp As New ClsEmployees '选择的上级员工信息
    Public MyCheck As New ClsCheckIn
    Public MyEva As New ClsEvaluation
    Public MySal As New ClsSalary
    Public MyRule As New ClsSalaryRules
    Public Arr_DepName() As String
    Public Arr_DepDescribe() As String
    Public Arr_DepId() As Short
    '员工数组
    Public Arr_EmpId() As Short

    Public Sub EnterTAB(ByRef KeyAscii As Short)
        If KeyAscii = 13 Then '13表示回车键
            System.Windows.Forms.SendKeys.Send("{TAB}") '转换为TAB键
        End If
    End Sub

    Public Sub Add_DepToTree(ByRef TreeView1 As System.Windows.Forms.TreeView, ByVal TmpKey As String)
        Dim FocusDepBh As Object
        Dim FocusDepName As Object
        Dim FocusDepKey As Object
        Dim i As Object
        Dim Bh As Integer
        Dim TmpNode As System.Windows.Forms.TreeNode
        '当前选择结点的关键字
        Dim CurKey As String
        '临时数组
        Dim TmpArr_DepName() As String
        Dim TmpArr_DepId() As Short
        ReDim TmpArr_DepName(0)
        ReDim TmpArr_DepId(0)
        '从关键字中读取当前的部门编号
        Bh = Val(Right(TmpKey, Len(TmpKey) - 1))
        '获取当前部门信息
        MyDep.GetInfo((Bh))
        '读取当前部门的下一级部门数据
        MyDep.Load_Department_ByUpper((Bh))
        '将下一级部门数据赋值到临时数组中
        i = 0
        Do While Arr_DepName(i) <> ""
            ReDim Preserve TmpArr_DepName(i + 1)
            TmpArr_DepName(i) = Arr_DepName(i)
            ReDim Preserve TmpArr_DepId(i + 1)
            TmpArr_DepId(i) = Arr_DepId(i)
            i = i + 1
        Loop

        i = 0
        Do While TmpArr_DepName(i) <> ""
            '生成部门对应的关键字,格式为“字母a”+部门编号
            CurKey = "a" & Trim(Str(TmpArr_DepId(i)))
            '如果当前部门有下一级部门,则显示文件夹图标
            If MyDep.HaveSon(TmpArr_DepId(i)) = True Then
                TmpNode = TreeView1.Nodes.Find(TmpKey, True)(0).Nodes.Add(CurKey, TmpArr_DepName(i), 0, 2)
                TmpNode.SelectedImageIndex = 2
                '否则显示叶结点图标
            Else
                TmpNode = TreeView1.Nodes.Find(TmpKey, True)(0).Nodes.Add(CurKey, TmpArr_DepName(i), 0, 2)
            End If
            'FocusDepName、FocusDepBh和FocusDepKey分别表示希望选中的部门的名称、编号和关键字
            If FocusDepName <> "" And TmpArr_DepName(i) = FocusDepName Then
                TmpNode.Checked = True
                FocusDepKey = CurKey
            End If
            If FocusDepBh > 0 And TmpArr_DepId(i) = FocusDepBh Then
                TmpNode.Checked = True
                FocusDepKey = CurKey
            End If
            If FocusDepKey <> "" And CurKey = FocusDepKey Then
                TmpNode.Checked = True
            End If
            '以当前部门为参数递归调用
            Add_DepToTree(TreeView1, CurKey)
            i = i + 1
        Loop
    End Sub
    Public Function InCombo(ByVal Str_Renamed As String, ByVal Combo1 As System.Windows.Forms.ComboBox) As Boolean
        Dim i As Object
        i = 0
        Do While i < Combo1.Items.Count
            If Combo1.Items(i).ToString = Trim(Str_Renamed) Then
                InCombo = True
                Exit Function
            End If
            i = i + 1
        Loop
        MsgBox(Str_Renamed & " 不在列表中,请重新设置")
        InCombo = False
    End Function

    Public Function In_Int(ByRef KeyAscii As Short) As Boolean
        Dim i As Integer
        Dim Ch_Accept_Int(20) As String
        '可以接受的字符数组
        Ch_Accept_Int(0) = "0"
        Ch_Accept_Int(1) = "1"
        Ch_Accept_Int(2) = "2"
        Ch_Accept_Int(3) = "3"
        Ch_Accept_Int(4) = "4"
        Ch_Accept_Int(5) = "5"
        Ch_Accept_Int(6) = "6"
        Ch_Accept_Int(7) = "7"
        Ch_Accept_Int(8) = "8"
        Ch_Accept_Int(9) = "9"
        Ch_Accept_Int(10) = Chr(8)
        '检查输入字符是否在数组中
        In_Int = False
        For i = 0 To 10
            If Chr(KeyAscii) = Ch_Accept_Int(i) Then
                In_Int = True
            End If
        Next
    End Function

    Public Function In_Single(ByRef KeyAscii As Short) As Boolean
        Dim i As Integer
        Dim Ch_Accept_Single(20) As String
        '可以接受的字符数组
        Ch_Accept_Single(0) = "0"
        Ch_Accept_Single(1) = "1"
        Ch_Accept_Single(2) = "2"
        Ch_Accept_Single(3) = "3"
        Ch_Accept_Single(4) = "4"
        Ch_Accept_Single(5) = "5"
        Ch_Accept_Single(6) = "6"
        Ch_Accept_Single(7) = "7"
        Ch_Accept_Single(8) = "8"
        Ch_Accept_Single(9) = "9"
        Ch_Accept_Single(10) = "."
        Ch_Accept_Single(11) = "-"
        Ch_Accept_Single(12) = Chr(8)
        '检查输入字符是否在数组中
        In_Single = False
        For i = 0 To 12
            If Chr(KeyAscii) = Ch_Accept_Single(i) Then
                In_Single = True
            End If
        Next
    End Function

End Module

⌨️ 快捷键说明

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