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

📄 frmstudentg.frm

📁 北大青鸟教学管理系统是学习规范编程范本.功能非常完备,代码编写有章法,不可多得
💻 FRM
📖 第 1 页 / 共 3 页
字号:
        MsflxStuInfo.Text = Empty
    Next intIndex
    Call Init           '初始化文本框
    
    Set Rst = Nothing
    If Fun_Rst("studentinfo") Then
        Rst.Filter = (strSearch)   '过滤
        If Rst.BOF = True And Rst.EOF = True Then
            MsgBox "没有任何记录....", vbInformation + vbOKOnly, "检索记录"
            cmdLast.Enabled = False
            cmdFirst.Enabled = False
            cmdPrevious.Enabled = False
            cmdNext.Enabled = False
        Else
            Do While Rst.EOF = False
                MsflxStuInfo.Row = MsflxStuInfo.Rows - 1
                MsflxStuInfo.Col = 0
                MsflxStuInfo.Text = MsflxStuInfo.Rows - 2   '序号
                MsflxStuInfo.Col = 1
                MsflxStuInfo.Text = Rst.Fields("StudentNo")
                MsflxStuInfo.Col = 2
                MsflxStuInfo.Text = Rst.Fields("name")
                MsflxStuInfo.Col = 3
                MsflxStuInfo.Text = Rst.Fields("py")
                MsflxStuInfo.Col = 4
                MsflxStuInfo.Text = Rst.Fields("sex")
                MsflxStuInfo.Col = 5
                MsflxStuInfo.Text = Rst.Fields("identityNo")
                MsflxStuInfo.Col = 6
                MsflxStuInfo.Text = Rst.Fields("classno")
                MsflxStuInfo.Col = 7
                If Rst.Fields("school") <> "" Then
                    MsflxStuInfo.Text = Rst.Fields("school")
                Else
                      MsflxStuInfo.Text = Empty
                End If
                MsflxStuInfo.Col = 8
                MsflxStuInfo.Text = Rst.Fields("degree")
                MsflxStuInfo.Col = 9
                If Rst.Fields("specialty") <> "" Then
                    MsflxStuInfo.Text = Rst.Fields("specialty")
                Else
                    MsflxStuInfo.Text = Empty
                End If
                MsflxStuInfo.Col = 10
                MsflxStuInfo.Text = Rst.Fields("certificate")
                MsflxStuInfo.Col = 11
                MsflxStuInfo.Text = Rst.Fields("jobStatus")
                MsflxStuInfo.Col = 12
                If Rst.Fields("jobunit") <> "" Then
                    MsflxStuInfo.Text = Rst.Fields("jobunit")
                Else
                    MsflxStuInfo.Text = Empty
                End If
                MsflxStuInfo.Col = 13
                If Rst.Fields("jobtype") <> "" Then
                    MsflxStuInfo.Text = Rst.Fields("jobtype")
                Else
                    MsflxStuInfo.Text = Empty
                End If
                MsflxStuInfo.Col = 14
                MsflxStuInfo.Text = Rst.Fields("Address")
                MsflxStuInfo.Col = 15
                MsflxStuInfo.Text = Rst.Fields("maincode")
                MsflxStuInfo.Col = 16
                MsflxStuInfo.Text = Rst.Fields("Tel")
                MsflxStuInfo.Col = 17
                If Rst.Fields("toCity") <> Null Then
                    MsflxStuInfo.Text = Rst.Fields("toCity")
                Else
                    MsflxStuInfo.Text = Empty
                End If
                MsflxStuInfo.Col = 18
                If Rst.Fields("toPost") <> Null Then
                    MsflxStuInfo.Text = Rst.Fields("toPost")
                Else
                    MsflxStuInfo.Text = Empty
                End If
                MsflxStuInfo.Col = 19
                MsflxStuInfo.Text = Rst.Fields("Status")
                MsflxStuInfo.Col = 20
                If Rst.Fields("remark") <> Null Then
                    MsflxStuInfo.Text = Rst.Fields("remark")
                Else
                    MsflxStuInfo.Text = Empty
                End If
                
                Rst.MoveNext
                If Rst.EOF = False Then
                    MsflxStuInfo.AddItem Empty
                End If
            Loop
            MsflxStuInfo.Row = 2
            Call DisplayInfo
            MsgBox "信息检索成功....", vbInformation + vbOKOnly, "信息检索"
        End If
    Else
        MsgBox "信息检索失败", vbInformation + vbOKOnly, "检索"
    End If
    cmdLast.Enabled = True
    cmdFirst.Enabled = True
    cmdPrevious.Enabled = True
    cmdNext.Enabled = True
    cmdAdd.Enabled = True
    cmdDel.Enabled = True
    cmdModi.Enabled = True
    strSearch = Empty
    Exit Sub
Err:
    If Err.Number = 94 Then
        Resume Next
    Else
        MsgBox "未知错误:" & Err.Description & vbCrLf & "错误代号:" & Err.Number, vbCritical + vbOKOnly, "未知错误"
    End If
End Sub


Private Sub Command1_Click()
    frmSearch.Show vbModal
End Sub



Private Sub Form_Load()
    IfSave = True              '默认没有需要保存的记录
    Call Pri.Open("classinfo", Con, adOpenDynamic, adLockReadOnly)
    If Not (Pri.EOF = True And Pri.BOF = True) Then
        Pri.MoveFirst
    End If
    Do While Pri.EOF = False            '从班级列表中读取班级信息
        cmbClassNo.AddItem Pri.Fields("classno")
        Pri.MoveNext
    Loop
    If cmbClassNo.ListCount > 0 Then
        cmbClassNo.ListIndex = 0
    End If
    Pri.Close   '读取班级列表中班级信息后,关闭记录集
    Call Pri.Open("scoreinfo", Con, adOpenDynamic, adLockReadOnly)      '打开成绩表,查看在其中是否引用了"学号"
    strSearch = Empty       '清空查询条件
    cmbSex.ListIndex = 0
    cmbDegree.ListIndex = 0
    cmbJobStatus.ListIndex = 0
    cmbStatus.ListIndex = 0
    cmbCertificate.ListIndex = 0
    
    Dim intIndex As Integer                 '初始化msflexgrid
    MsflxStuInfo.MergeCells = flexMergeFree

    MsflxStuInfo.Row = 0
     MsflxStuInfo.ColWidth(0) = 600                '设定第一列宽为600
    For intIndex = 1 To MsflxStuInfo.Cols - 1
        MsflxStuInfo.Col = intIndex
        MsflxStuInfo.Text = "学员信息列表"
        MsflxStuInfo.ColWidth(intIndex) = 1200

    Next intIndex
    MsflxStuInfo.MergeRow(0) = True
    
    MsflxStuInfo.Row = 1
    MsflxStuInfo.Col = 0
    MsflxStuInfo.Text = "序号"
    
    MsflxStuInfo.Col = 1
    MsflxStuInfo.Text = "学号"
    
    MsflxStuInfo.Col = 2
    MsflxStuInfo.Text = "姓名"

    MsflxStuInfo.Col = 3
    MsflxStuInfo.Text = "姓名拼音"

    MsflxStuInfo.Col = 4
    MsflxStuInfo.Text = "性别"
    
    MsflxStuInfo.Col = 5
    MsflxStuInfo.Text = "身份证号"
    
    MsflxStuInfo.Col = 6
    MsflxStuInfo.Text = "班级编号"
    
    MsflxStuInfo.Col = 7
    MsflxStuInfo.Text = "毕业学校"
        
    MsflxStuInfo.Col = 8
    MsflxStuInfo.Text = "学历"
        
    MsflxStuInfo.Col = 9
    MsflxStuInfo.Text = "专业"
        
    MsflxStuInfo.Col = 10
    MsflxStuInfo.Text = "已持有证书"
        
    MsflxStuInfo.Col = 11
    MsflxStuInfo.Text = "工作状态"
        
    MsflxStuInfo.Col = 12
    MsflxStuInfo.Text = "工作单位"
        
    MsflxStuInfo.Col = 13
    MsflxStuInfo.Text = "工作种类"
        
    MsflxStuInfo.Col = 14
    MsflxStuInfo.Text = "家庭住址"
        
    MsflxStuInfo.Col = 15
    MsflxStuInfo.Text = "邮政编码"
        
    MsflxStuInfo.Col = 16
    MsflxStuInfo.Text = "联系电话"
        
    MsflxStuInfo.Col = 17
    MsflxStuInfo.Text = "就业意向城市"
        
    MsflxStuInfo.Col = 18
    MsflxStuInfo.Text = "就业意向岗位"
        
    MsflxStuInfo.Col = 19
    MsflxStuInfo.Text = "状态"
        
    MsflxStuInfo.Col = 20
    MsflxStuInfo.Text = "备注"
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Pri.Close       '关闭记录集
End Sub

Private Sub MSFlxStuInfo_Click()
    If IfSave = False Then
        If MsgBox("数据未保存,是否保存现有数据?", vbInformation + vbYesNo, "保存") = vbYes Then
            Call cmdSaveInfo_Click
        Else
            fraStuInfo.Enabled = False
            txtStuNo.Enabled = False
            cmdSaveInfo.Enabled = False
            IfSave = True
        End If
    End If
    Call DisplayInfo
End Sub
Sub DisplayInfo()
    Dim I As Integer
    
    MsflxStuInfo.Col = 1
    txtStuNo = MsflxStuInfo.Text
    MsflxStuInfo.Col = 2
    txtStuName = MsflxStuInfo.Text
    MsflxStuInfo.Col = 3
    txtStuNamePY = MsflxStuInfo.Text
    MsflxStuInfo.Col = 4
    If MsflxStuInfo.Text = "女" Then
        cmbSex.ListIndex = 1
    End If
    MsflxStuInfo.Col = 5
    txtIdentity = MsflxStuInfo.Text
    MsflxStuInfo.Col = 6
    
    cmbClassNo.ListIndex = 0
    For I = 0 To cmbClassNo.ListCount - 1
        cmbClassNo.ListIndex = I
        If cmbClassNo.Text = MsflxStuInfo.Text Then
            Exit For
        End If
    Next I
    MsflxStuInfo.Col = 7
    txtSchool = MsflxStuInfo.Text    '毕业学校
    MsflxStuInfo.Col = 8            '学历
    If MsflxStuInfo.Text = "中专" Then
        cmbDegree.ListIndex = 1
    ElseIf MsflxStuInfo.Text = "大专" Then
        cmbDegree.ListIndex = 2
    ElseIf MsflxStuInfo.Text = "本科" Then
        cmbDegree.ListIndex = 3
    ElseIf cmbDegree.ListIndex = 1 Then
        cmbDegree.ListIndex = 4
    End If
    MsflxStuInfo.Col = 9
    txtSpecialty = MsflxStuInfo.Text
    MsflxStuInfo.Col = 10
    cmbCertificate.ListIndex = 0
    For I = 0 To cmbCertificate.ListCount - 1   ' 已持有证书
        cmbCertificate.ListIndex = I
        If cmbCertificate.Text = MsflxStuInfo.Text Then
            Exit For
        End If
    Next I
    MsflxStuInfo.Col = 11
    
    cmbJobStatus.ListIndex = 0
    For I = 0 To cmbJobStatus.ListCount - 1   ' 工作状态
        cmbJobStatus.ListIndex = I
        If cmbJobStatus.Text = MsflxStuInfo.Text Then
            Exit For
        End If
    Next I
    
    MsflxStuInfo.Col = 12
    txtJobUnit = MsflxStuInfo.Text
    MsflxStuInfo.Col = 13
    txtJobType = MsflxStuInfo.Text
    MsflxStuInfo.Col = 14
    txtAddress = MsflxStuInfo.Text
    MsflxStuInfo.Col = 15
    txtMaincode = MsflxStuInfo.Text
    MsflxStuInfo.Col = 16
    txtTel = MsflxStuInfo.Text
    MsflxStuInfo.Col = 17
    txtToCity = MsflxStuInfo.Text
    MsflxStuInfo.Col = 18
    txtToPost = MsflxStuInfo.Text
    MsflxStuInfo.Col = 19
    
    cmbStatus.ListIndex = 0
    For I = 0 To cmbStatus.ListCount - 1   ' 工作状态
        cmbStatus.ListIndex = I
        If cmbStatus.Text = MsflxStuInfo.Text Then
            Exit For
        End If
    Next I

    MsflxStuInfo.Col = 20
    txtRemark = MsflxStuInfo.Text

    Dim intCol As Integer
    Dim intRow As Integer
    Dim TmpRow As Integer
    TmpRow = MsflxStuInfo.Row
    For intRow = 2 To MsflxStuInfo.Rows - 1
        MsflxStuInfo.Row = intRow
        If TmpRow = intRow Then
            For intCol = 1 To MsflxStuInfo.Cols - 1
                MsflxStuInfo.Col = intCol
                MsflxStuInfo.CellForeColor = vbYellow
                MsflxStuInfo.CellBackColor = &H8000000D
            Next intCol
        Else
            For intCol = 1 To MsflxStuInfo.Cols - 1
                MsflxStuInfo.Col = intCol
                MsflxStuInfo.CellBackColor = vbWhite
                MsflxStuInfo.CellForeColor = vbBlack
            Next intCol
        End If
    Next intRow
    MsflxStuInfo.Row = TmpRow
End Sub

Private Sub cmdLast_Click()                     '导航栏
    MsflxStuInfo.Row = MsflxStuInfo.Rows - 1
    DisplayInfo
End Sub

Private Sub cmdNext_Click()                         '下一条
    If MsflxStuInfo.Row < MsflxStuInfo.Rows - 1 Then
        MsflxStuInfo.Row = MsflxStuInfo.Row + 1
        DisplayInfo
    End If
End Sub

Private Sub cmdPrevious_Click()     '上一条
    If MsflxStuInfo.Row > 2 Then
        MsflxStuInfo.Row = MsflxStuInfo.Row - 1
        DisplayInfo
    End If
End Sub

Private Sub cmdFirst_Click()                        '最前一条
    MsflxStuInfo.Row = 2
    DisplayInfo
End Sub

Sub Init()
    txtStuNo = Empty
    txtStuName = Empty
    txtStuNamePY = Empty
    cmbSex.ListIndex = 0
    txtIdentity = Empty
    cmbClassNo.ListIndex = 0
    txtSchool = Empty
    cmbDegree.ListIndex = 0
    txtSpecialty = Empty
    cmbCertificate.ListIndex = 0
    cmbJobStatus.ListIndex = 0
    txtJobUnit = Empty
    txtJobType = Empty
    txtAddress = Empty
    txtMaincode = Empty
    txtTel = Empty
    txtToCity = Empty
    txtToPost = Empty
    cmbStatus.ListIndex = 0
    txtRemark = Empty
End Sub

⌨️ 快捷键说明

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