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

📄 studentedit.frm

📁 是我应我们学校学工部做的软件,其主要是解决想我们学校这样的条件--各个办公室之间还没有建立联网,而且学校分为两个校区(又不在一个城市).   因此
💻 FRM
📖 第 1 页 / 共 3 页
字号:
        Exit Sub
    End If
    temp.Close
    Set temp = Nothing
    
        
    If Len(Text1.Text) = 0 Then
        MsgBox "您输入的学号不能为零位,此学号不合法。" & Chr(13) & Chr(10) & "请你查证后,重新输入", vbOKOnly Or vbInformation, "提示"
        Text1.SetFocus
        Exit Sub
    End If
    If Len(Trim(Text2.Text)) > 8 Or Len(Trim(Text2.Text)) < 1 Then
        MsgBox "您输入的学生姓名太长。" & Chr(13) & Chr(10) & "请您确定您输入的名称的正确性(确保名称中没有空格的符号)。", vbOKOnly Or vbInformation, "提示"
        Text2.SetFocus
        Exit Sub
    End If
    
    If Text3.Text = "男" Then ll = True Else ll = False
    If Text4.Text = "无" Then ll1 = 0
    If Text4.Text = "中国共青团员" Then ll1 = 1
    If Text4.Text = "中国共产党员" Then ll1 = 2
    main.connect.Execute "update [student] set [stid]='" & Text1.Text & "',[na]='" & Text2.Text & "',[sex]=" & ll & ",[po]=" & ll1 & " where [ID]=" & nowid
    ListView1.ListItems(myindex).Text = Text1.Text
    ListView1.ListItems(myindex).SubItems(1) = Text2.Text
    ListView1.ListItems(myindex).SubItems(2) = Text3.Text
    ListView1.ListItems(myindex).SubItems(3) = Text4.Text
    MsgBox "修改成功!", vbOKOnly Or vbInformation, "提示"
    ListView1.SetFocus
  SendKeys "{DOWN}"
    
End Sub

Private Sub Command3_Click()
    Picture2.Visible = False
    Picture3.Visible = True
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = "男"
    Text4.Text = "中国共青团员"
    Text1.SetFocus
    Me.Caption = "学生名册管理[输入模式]"
    Label1.Caption = "批量输入模式"
End Sub

Private Sub Command4_Click()
    Dim kk As New ADODB.Recordset
    kk.Open "select * from [wf] where [stid]=" & nowid, main.connect, 3, 2
    If kk.RecordCount <> 0 Then
        MsgBox "此学生已有成绩纪录," & Chr(13) & Chr(10) & "欲删除此学生,请使用退学功能", vbOKOnly Or vbInformation, "提示"
        Exit Sub
    End If
    kk.Close
    kk.Open "select * from [jc] where [stid]=" & nowid, main.connect, 3, 2
    If kk.RecordCount <> 0 Then
        MsgBox "此学生已有成绩纪录," & Chr(13) & Chr(10) & "欲删除此学生,请使用退学功能", vbOKOnly Or vbInformation, "提示"
        Exit Sub
    End If
    kk.Close
    
    If MsgBox("您确定删除此学生吗?", vbYesNo Or vbQuestion, "提示") <> vbYes Then Exit Sub
    main.connect.Execute "Delete from [student] where [ID]=" & nowid
    ListView1.ListItems.Remove (ListView1.SelectedItem.Key)
    num = num - 1
    If num = 0 Then
        MsgBox "此班级已经没有注册学生," & Chr(13) & Chr(10) & "无法在修改模式工作。", vbOKOnly Or vbInformation, "提示"
        Call Command3_Click
        Exit Sub
    End If
    Label9.Caption = "现有学生" & num & "名"
    Text1.Text = ListView1.SelectedItem.Text
    Text2.Text = ListView1.SelectedItem.SubItems(1)
    Text3.Text = ListView1.SelectedItem.SubItems(2)
    Text4.Text = ListView1.SelectedItem.SubItems(3)
    nowid = Right(ListView1.SelectedItem.Key, Len(ListView1.SelectedItem.Key) - 1)
End Sub

Private Sub Command5_Click()
Text1.Text = ""
    Text2.Text = ""
    Text3.Text = "男"
    Text4.Text = "中国共青团员"
    Text1.SetFocus
End Sub

Private Sub Command6_Click()
    If Len(Text1.Text) = 0 Then
        MsgBox "您输入的学号不能为零位,此学好不合法。" & Chr(13) & Chr(10) & "请你查证后,重新输入", vbOKOnly Or vbInformation, "提示"
        Text1.SetFocus
        Exit Sub
    End If
    Dim temp As New ADODB.Recordset
    temp.Open "select * from [student] where [stid]='" & Text1.Text & "'", main.connect, 3, 2
    If temp.RecordCount <> 0 Then
        MsgBox "您输入的学号已被注册。" & Chr(13) & Chr(10) & "请您查证后在输入。", vbOKOnly Or vbInformation, "提示"
        Text1.SetFocus
        temp.Close
        Set temp = Nothing
        Exit Sub
    End If
    temp.Close
    Set temp = Nothing
    If Len(Trim(Text2.Text)) > 8 Or Len(Trim(Text2.Text)) < 1 Then
        MsgBox "您输入的学生姓名太长。" & Chr(13) & Chr(10) & "请您确定您输入的名称的正确性(确保名称中没有空格的符号)。", vbOKOnly Or vbInformation, "提示"
        Text2.SetFocus
        Exit Sub
    End If
    
    If Text3.Text = "男" Then ll = True Else ll = False
    If Text4.Text = "无" Then ll1 = 0
    If Text4.Text = "中国共青团员" Then ll1 = 1
    If Text4.Text = "中国共产党员" Then ll1 = 2
    main.connect.Execute "insert into [student]([na],[sex],[stid],[po],[clasid]) values('" & Trim(Text2.Text) & "'," & ll & ",'" & Text1.Text & "'," & ll1 & "," & nn & " )"
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = "男"
    Text4.Text = "中国共青团员"
    Beep
    num = num + 1
    Label9.Caption = "现有学生" & num & "名"
    Text1.SetFocus
    Dim itmX As ListItem
    
    
    Dim ff As New ADODB.Recordset
    ff.Open "select * from [student] ", main.connect, 3, 2
    If ff.RecordCount <> 0 Then
        ff.MoveLast
        Set itmX = ListView1.ListItems.Add(, "S" & ff.Fields(0), ff.Fields(3), 1, 1)
        itmX.SubItems(1) = ff.Fields(1)
        If ff.Fields(2) = True Then itmX.SubItems(2) = "男" Else itmX.SubItems(2) = "女"
        If ff.Fields(4) = 0 Then itmX.SubItems(3) = "无"
        If ff.Fields(4) = 1 Then itmX.SubItems(3) = "中国共青团员"
        If ff.Fields(4) = 2 Then itmX.SubItems(3) = "中国共产党员"
            If i = 1 Then
                Text1.Text = ff.Fields(3)
                Text2.Text = itmX.SubItems(1)
                Text3.Text = itmX.SubItems(2)
                Text4.Text = itmX.SubItems(3)
                nowid = ff.Fields(0)
            End If
        End If
        ff.Close
        Set ff = Nothing
End Sub

Private Sub Command7_Click()
    Unload Me
End Sub

Private Sub Command8_Click()
If Label9.Caption = "现有学生0名" Then
    MsgBox "本班没有学生注册,不能进行编辑操作", vbOKOnly, "提示"
    Exit Sub
End If
Picture3.Visible = False
Picture2.Visible = True
Call ListView1_ItemClick(ListView1.SelectedItem)
Me.Caption = "学生名册管理[修改模式]"
Label1.Caption = "信息修改模式"
End Sub

Private Sub Form_Load()
    Call ListView1.ListItems.Add(, "Sss", "dkfjkdjfkdfj", 1, 1)
    ListView1.ListItems.Clear
    ListView1.Refresh
    Dim itmX As ListItem

    Label3.Caption = kk
    Dim bb As New ADODB.Recordset
    bb.Open "select * from [student] where [clasid]=" & nn & " order by [stid]", main.connect, 3, 2
    num = bb.RecordCount
    Label9.Caption = "现有学生" & num & "名"
    Text3.Text = "男"
    Text4.Text = "中国共青团员"
    
    For i = 1 To bb.RecordCount
        Set itmX = ListView1.ListItems.Add(, "S" & bb.Fields(0), bb.Fields(3), 1, 1)
        itmX.SubItems(1) = bb.Fields(1)
        If bb.Fields(2) = True Then itmX.SubItems(2) = "男" Else itmX.SubItems(2) = "女"
        If bb.Fields(4) = 0 Then itmX.SubItems(3) = "无"
        If bb.Fields(4) = 1 Then itmX.SubItems(3) = "中国共青团员"
        If bb.Fields(4) = 2 Then itmX.SubItems(3) = "中国共产党员"
        If i = 1 Then
            Text3.Text = "男"
            Text4.Text = "中国共青团员"
        End If
        bb.MoveNext
    Next
    bb.Close
    ListView1.Refresh
End Sub

Private Sub Form_Resize()
    On Error Resume Next
    If Me.Height < 5745 Then Me.Height = 5745
    If Me.Width < 9660 Then Me.Width = 9660
    Picture1.Height = Me.Height - 500
    Frame1.Left = Me.Width - Frame1.Width - 200
    ListView1.Height = Me.Height - 500
    Picture2.Left = Me.Width - Picture2.Width - 200
    Picture2.Top = Me.Height - Picture2.Height - 500
    
    Picture3.Left = Me.Width - Picture3.Width - 200
    Picture3.Top = Me.Height - Picture3.Height - 500
    ListView1.Width = Me.Width - Frame1.Width - Picture1.Width - 350
End Sub

Private Sub ListView1_ItemClick(ByVal Item As MSComctlLib.ListItem)
    If Picture2.Visible = True Then
        Text1.Text = Item.Text
        Text2.Text = Item.SubItems(1)
        Text3.Text = Item.SubItems(2)
        Text4.Text = Item.SubItems(3)
    End If
    nowid = Right(Item.Key, Len(Item.Key) - 1)
    myindex = Item.Index
    Text1.SetFocus
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        KeyAscii = 0
        Text2.SetFocus
    End If
    If KeyAscii >= 48 And KeyAscii <= 57 Then
    Else
        If KeyAscii = 13 Then
            KeyAscii = 0
            Text2.SetFocus
        Else
            If KeyAscii = 8 Then
            Else
                KeyAscii = 0
            End If
        End If
    End If
       
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        KeyAscii = 0
        Text3.SetFocus
    End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 38 Or KeyCode = 40 Then Call UpDown2_UpClick
    If KeyCode = 13 Then Text4.SetFocus
    KeyCode = 0
End Sub



Private Sub Text3_KeyPress(KeyAscii As Integer)
    KeyAscii = 0
End Sub
Private Sub UpDown2_DownClick()
    Call UpDown2_UpClick
End Sub

Private Sub UpDown2_UpClick()
    If Text3.Text = "男" Then Text3.Text = "女" Else Text3.Text = "男"
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
    KeyAscii = 0
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = 38 Then Call UpDown1_UpClick
    If KeyCode = 40 Then Call UpDown1_DownClick
    
    If KeyCode = 13 Then
        If Picture2.Visible = True Then Command2.SetFocus Else Command6.SetFocus
    End If
    KeyCode = 0
End Sub
Private Sub UpDown1_DownClick()
    If Text4.Text = "无" Then
        Text4.Text = "中国共青团员"
        Exit Sub
    End If
    If Text4.Text = "中国共产党员" Then
        Text4.Text = "无"
        Exit Sub
    End If
    If Text4.Text = "中国共青团员" Then
        Text4.Text = "中国共产党员"
        Exit Sub
    End If
End Sub

Private Sub UpDown1_UpClick()
    If Text4.Text = "无" Then
        Text4.Text = "中国共产党员"
        Exit Sub
    End If
    If Text4.Text = "中国共产党员" Then
        Text4.Text = "中国共青团员"
        Exit Sub
    End If
    If Text4.Text = "中国共青团员" Then
        Text4.Text = "无"
        Exit Sub
    End If
End Sub

⌨️ 快捷键说明

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