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

📄 form1.frm

📁 我自己编写和收集一些主要的VB的能实现的功能都基本集合在一起了
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form Form1 
   Caption         =   "学生成绩管理"
   ClientHeight    =   3570
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7170
   LinkTopic       =   "Form1"
   ScaleHeight     =   3570
   ScaleWidth      =   7170
   StartUpPosition =   3  '窗口缺省
   Begin VB.PictureBox PicBar 
      Align           =   2  'Align Bottom
      BorderStyle     =   0  'None
      Height          =   495
      Left            =   0
      ScaleHeight     =   495
      ScaleWidth      =   7170
      TabIndex        =   1
      Top             =   2745
      Width           =   7170
      Begin VB.CommandButton CmdExit 
         Caption         =   "退出(&X)"
         Height          =   375
         Left            =   5880
         TabIndex        =   6
         Top             =   0
         Width           =   975
      End
      Begin VB.CommandButton CmdRefresh 
         Caption         =   "刷新"
         Height          =   375
         Left            =   4440
         TabIndex        =   5
         Top             =   0
         Width           =   975
      End
      Begin VB.CommandButton CmdDelete 
         Caption         =   "删除"
         Height          =   375
         Left            =   2880
         TabIndex        =   4
         Top             =   0
         Width           =   975
      End
      Begin VB.CommandButton CmdUpdate 
         Caption         =   "更新"
         Height          =   375
         Left            =   1320
         TabIndex        =   3
         Top             =   0
         Width           =   975
      End
      Begin VB.CommandButton CmdAdd 
         Caption         =   "添加"
         Height          =   375
         Left            =   360
         TabIndex        =   2
         Top             =   0
         Width           =   975
      End
   End
   Begin MSDataGridLib.DataGrid DataGrid1 
      Bindings        =   "Form1.frx":0000
      Height          =   2535
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   6855
      _ExtentX        =   12091
      _ExtentY        =   4471
      _Version        =   393216
      HeadLines       =   1
      RowHeight       =   16
      AllowAddNew     =   -1  'True
      AllowDelete     =   -1  'True
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   2
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Align           =   2  'Align Bottom
      Height          =   330
      Left            =   0
      Top             =   3240
      Width           =   7170
      _ExtentX        =   12647
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Adodc1_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
  
  Adodc1.Caption = "记录总数:" & CStr(Adodc1.Recordset.RecordCount) & Space(20) & "当前记录号:" & CStr(Adodc1.Recordset.AbsolutePosition)
End Sub

Private Sub CmdAdd_Click()
  Adodc1.Recordset.MoveLast
  DataGrid1.SetFocus
  SendKeys "{down}"

   
End Sub

Private Sub CmdDelete_Click()
    Adodc1.Recordset.Delete
    Adodc1.Recordset.MoveNext
    If Adodc1.Recordset.EOF Then
       Adodc1.Recordset.MoveLast
    End If
    
End Sub

Private Sub CmdExit_Click()
   If MsgBox("真的要退出吗?", vbQuestion + vbYesNo, "退出") = vbYes Then
      End
   End If
   
End Sub

Private Sub CmdRefresh_Click()
   Adodc1.Refresh
End Sub

Private Sub CmdUpdate_Click()
 Adodc1.Recordset.UpdateBatch adAffectAll
End Sub

Private Sub Form_Load()
       Dim DBName As String, cn As String
       DBName = App.Path + "\Student.mdb"      ' 设置要访问的数据库
       cn = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBName
       Adodc1.ConnectionString = cn         ' 设置连接字符串
       Adodc1.CommandType = adCmdTable
       Adodc1.RecordSource = "xscj"         ' 设置所要访问的数据表
       Set DataGrid1.DataSource = Adodc1
End Sub

Private Sub Form_Resize()
    DataGrid1.Width = Me.ScaleWidth - 300
    DataGrid1.Height = Me.ScaleHeight - (PicBar.Height + Adodc1.Height) - DataGrid1.Top - 100
    
End Sub

⌨️ 快捷键说明

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