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

📄 frmchushi.frm

📁 我编的学分管理程序,应用程序 原代码都有!VB入门的好东西
💻 FRM
字号:
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.1#0"; "COMCTL32.OCX"
Begin VB.Form Frmchushi 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "基本表"
   ClientHeight    =   2730
   ClientLeft      =   1215
   ClientTop       =   2550
   ClientWidth     =   2940
   Icon            =   "Frmchushi.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   2730
   ScaleWidth      =   2940
   Begin ComctlLib.Toolbar Tbar1 
      Align           =   2  'Align Bottom
      Height          =   855
      Left            =   0
      TabIndex        =   0
      Top             =   1875
      Width           =   2940
      _ExtentX        =   5186
      _ExtentY        =   1508
      ButtonWidth     =   1032
      ButtonHeight    =   1349
      Appearance      =   1
      ImageList       =   "ImageList1"
      _Version        =   327680
      BeginProperty Buttons {0713E452-850A-101B-AFC0-4210102A8DA7} 
         NumButtons      =   5
         BeginProperty Button1 {0713F354-850A-101B-AFC0-4210102A8DA7} 
            Caption         =   "向前"
            Key             =   "font"
            Object.Tag             =   ""
            ImageIndex      =   1
         EndProperty
         BeginProperty Button2 {0713F354-850A-101B-AFC0-4210102A8DA7} 
            Caption         =   "向后"
            Key             =   "back"
            Object.Tag             =   ""
            ImageIndex      =   2
         EndProperty
         BeginProperty Button3 {0713F354-850A-101B-AFC0-4210102A8DA7} 
            Caption         =   "添加"
            Key             =   "add"
            Object.Tag             =   ""
            ImageIndex      =   3
         EndProperty
         BeginProperty Button4 {0713F354-850A-101B-AFC0-4210102A8DA7} 
            Caption         =   "删除"
            Key             =   "del"
            Object.Tag             =   ""
            ImageIndex      =   4
         EndProperty
         BeginProperty Button5 {0713F354-850A-101B-AFC0-4210102A8DA7} 
            Caption         =   "退出"
            Key             =   "exit"
            Object.Tag             =   ""
            ImageIndex      =   5
         EndProperty
      EndProperty
      MouseIcon       =   "Frmchushi.frx":014A
   End
   Begin VB.TextBox Txthao 
      DataField       =   " "
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1080
      TabIndex        =   2
      Text            =   " "
      Top             =   240
      Width           =   1455
   End
   Begin VB.TextBox Txtming 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1080
      TabIndex        =   1
      Text            =   " "
      Top             =   1080
      Width           =   1455
   End
   Begin VB.Label Label1 
      Caption         =   "姓名:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   4
      Top             =   1200
      Width           =   855
   End
   Begin VB.Label Label2 
      Caption         =   "学号:"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   240
      TabIndex        =   3
      Top             =   360
      Width           =   975
   End
   Begin ComctlLib.ImageList ImageList1 
      Left            =   0
      Top             =   1560
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   32
      ImageHeight     =   32
      MaskColor       =   12632256
      _Version        =   327680
      BeginProperty Images {0713E8C2-850A-101B-AFC0-4210102A8DA7} 
         NumListImages   =   5
         BeginProperty ListImage1 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "Frmchushi.frx":0166
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "Frmchushi.frx":0480
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "Frmchushi.frx":079A
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "Frmchushi.frx":0AB4
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {0713E8C3-850A-101B-AFC0-4210102A8DA7} 
            Picture         =   "Frmchushi.frx":0BC6
            Key             =   ""
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "Frmchushi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim add As Variant
Dim fenrecord As Recordset



Private Sub Form_Load()
On Error GoTo de:
 

   Frmchushi.Left = 2500
   Frmchushi.Top = 1800

Set fenrecord = scoretab.OpenRecordset(dbOpenDynaset)
 
If scoretab.RecordCount = 0 Then

    fenrecord.AddNew
    fenrecord.Fields("姓名").Value = "系数"
   fenrecord.Fields("学号").Value = 0
  fenrecord.Update
    For i = 1 To se
    fenrecord.AddNew
    fenrecord.Fields("学号").Value = i
    fenrecord.Update
    Next i
    fenrecord.MoveFirst
    fenrecord.MoveNext
   With Tbar1
           .Buttons("font").Enabled = False
           .Buttons("back").Enabled = False
            .Buttons("del").Enabled = False
          Txthao.Text = 1
End With
End If

Exit Sub
de: If Err.Number = 12 Then _
 Unload Frmchushi

End Sub









Private Sub Tbar1_ButtonClick(ByVal Button As ComctlLib.Button)
On Error GoTo ao
Select Case Button.Key
Case "font"
  If fenrecord.AbsolutePosition = 1 Then
 Beep
 MsgBox "已达第一个记录!"
 Else
 fenrecord.MovePrevious
 End If
 

Case "back"

 fenrecord.MoveNext
 If fenrecord.EOF Then
 fenrecord.MoveLast
  Beep
 MsgBox "已达最后一个记录!"
 End If

Case "add"
 If Len(Trim(Txthao.Text)) = 0 Or Len(Trim(Txtming.Text)) = 0 Then
    MSG = "信息不全!"
     style = vbRetryCancel
     Beep
     If MsgBox(MSG, style, TiShi) = vbRetry Then
        Exit Sub
     End If
 End If
'====================
 ' Txthao.Text = fenrecord.AbsolutePosition
 
 fenrecord.Edit
   'fenrecord.Fields("学号").Value = Trim(Txthao.Text)
   fenrecord.Fields("姓名").Value = Trim(Txtming.Text)
 fenrecord.Update
 fenrecord.MoveNext
 'Txthao.Text = 1 + Txthao.Text

 'Txtming.Text = " "
Txtming.SetFocus
If fenrecord.EOF Then
MsgBox "记录已满!"
fenrecord.MoveLast
End If
'fenrecord.Close
Case "del"

If fenrecord.EOF = False Then
' msg="删除"& txtming.text& "同学的"
Else
fenrecord.MovePrevious
End If
fenrecord.Edit
fenrecord.Fields("姓名").Value = Null
fenrecord.Update

Case "exit"
Dim ming As Integer '学生数
 fenrecord.MoveFirst
ming = fenrecord.RecordCount - 1
MSG = "共有学生" & ming & "名,请再确认!"
 style = vbDefaultButton1 + vbInformation + vbYesNo
 If MsgBox(MSG, style, TiShi) = vbYes Then
    
    fenrecord.Close
    Unload Frmchushi
   MsgBox "请继续点击“添加”按钮!"
 Else
 Exit Sub
 End If


End Select
'If worktype <> 1 Then

'fenrecord.MovePrevious
Txthao.Text = fenrecord.Fields("学号").Value
  
  If VarType(fenrecord.Fields("姓名").Value) = vbNull Then
  Txtming.Text = " "
  Else
  Txtming.Text = fenrecord.Fields("姓名").Value
  'frm.Txtfen.Text = fenrecord.Fields(frm.Txtke.Text).Value
  End If




'Call display(Frmchushi, fenrecord)

'End If
Exit Sub
ao:
If Err.Number = 3021 Then
 Beep
 MsgBox "已达最后一个记录!"
 If fenrecord.EOF Then
 fenrecord.MovePrevious
 'Else
 'fenrecord.MoveNext
End If
 End If
End Sub

Private Sub Txtming_Change()
'If scoretab.RecordCount > 0 Then
  With Tbar1
           .Buttons("font").Enabled = True
           .Buttons("back").Enabled = True
           .Buttons("del").Enabled = True
    End With
    'Else
           
       'With Tbar1
      ' .Buttons("font").Enabled = False
         '  .Buttons("back").Enabled = False
          '  .Buttons("del").Enabled = False
'End With
'End If
End Sub

Private Sub Txtming_KeyPress(KeyAscii As Integer)
On Error GoTo d1
 If KeyAscii = 13 Then
     If Len(Trim(Txthao.Text)) = 0 Or Len(Trim(Txtming.Text)) = 0 Then
   
     MSG = "信息不全!"
     style = vbRetryCancel
     Beep
     If MsgBox(MSG, style, TiShi) = vbRetry Then
        Exit Sub
     End If
 End If
'====================
 ' Txthao.Text = fenrecord.AbsolutePosition
 
 fenrecord.Edit
   'fenrecord.Fields("学号").Value = Trim(Txthao.Text)
   fenrecord.Fields("姓名").Value = Trim(Txtming.Text)
 fenrecord.Update
 fenrecord.MoveNext
 'Txthao.Text = 1 + Txthao.Text

 'Txtming.Text = " "
Txtming.SetFocus
'fenrecord.Close
Else
Exit Sub
  
  End If
  Txthao.Text = fenrecord.Fields("学号").Value
  
  If VarType(fenrecord.Fields("姓名").Value) = vbNull Then
  Txtming.Text = " "
  Else
  Txtming.Text = fenrecord.Fields("姓名").Value
  'frm.Txtfen.Text = fenrecord.Fields(frm.Txtke.Text).Value
  End If
  Exit Sub
d1:
If Err.Number = 3021 Then
 Beep
 MsgBox "已达最后一个记录!"
 
End If
End Sub
  


⌨️ 快捷键说明

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