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

📄 studentall.frm

📁 带有SQL
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form studentall 
   Caption         =   "所有学生基本信息"
   ClientHeight    =   4650
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   10290
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   ScaleHeight     =   4650
   ScaleWidth      =   10290
   WindowState     =   2  'Maximized
   Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1 
      Height          =   3735
      Left            =   120
      TabIndex        =   0
      Top             =   960
      Width           =   6735
      _ExtentX        =   11880
      _ExtentY        =   6588
      _Version        =   393216
      Cols            =   20
      FixedCols       =   2
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "所有学生基本信息列表"
      BeginProperty Font 
         Name            =   "幼圆"
         Size            =   18
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   360
      Left            =   5520
      TabIndex        =   1
      Top             =   240
      Width           =   3600
   End
End
Attribute VB_Name = "studentall"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
  
    Call loading
    Dim MsgText As String
      Dim txtSQL As String
      '///////////////////////////////////
      txtSQL = "select * from student_if"
      Set mrc = ExecuteSQL(txtSQL, MsgText)
      '/////////////判断
      If mrc.EOF = True Then
          A = MsgBox("库里没东西!", 0, "警告")
          If A = 1 Then
             Exit Sub
          End If
      Else
      
  
     '调用几的自定义函数
       
       Call chushua
       Call shujujiaru
       Call yanse
      End If
End Sub

Private Sub loading()
    Me.Label1.Top = 0
   
    Me.Label1.Height = 400
    Me.MSFlexGrid1.Top = 500
    Me.MSFlexGrid1.Left = 100
    Me.MSFlexGrid1.Height = Me.Height + 2400
    Me.MSFlexGrid1.Width = Me.Width + 2100
End Sub
Private Sub yanse()             '定义一个让单双行显示不同的颜色
     Dim i As Integer
  With MSFlexGrid1
      .FillStyle = flexFillRepeat
      For i = 0 To .Rows - 1
     .Row = i: .Col = .FixedCols
     .ColSel = .Cols() - .FixedCols - 1
   If i Mod 2 = 0 Then
    .CellBackColor = QBColor(7)  ' 颜色值
Else
     .CellBackColor = QBColor(15) ' 颜色值
 End If
 Next i
End With

End Sub

Private Sub chushua()              '定义一个让学生信息的字段名在列表里显示出来的函数
       Me.MSFlexGrid1.TextMatrix(0, 0) = "学    号"
       Me.MSFlexGrid1.TextMatrix(0, 1) = "姓    名"
       Me.MSFlexGrid1.TextMatrix(0, 2) = "性    别"
       Me.MSFlexGrid1.TextMatrix(0, 3) = "年    级"
       Me.MSFlexGrid1.TextMatrix(0, 4) = "系    别"
       Me.MSFlexGrid1.TextMatrix(0, 5) = "班    别"
       Me.MSFlexGrid1.TextMatrix(0, 6) = "联系电话"
       Me.MSFlexGrid1.TextMatrix(0, 7) = "政治面貌"
       Me.MSFlexGrid1.TextMatrix(0, 8) = "居住楼号"
       Me.MSFlexGrid1.TextMatrix(0, 9) = "寝 室 号"
       Me.MSFlexGrid1.TextMatrix(0, 10) = "床    位"
       Me.MSFlexGrid1.TextMatrix(0, 11) = "备    注"
End Sub


Private Sub shujujiaru()        '定义一个让所有的学生信息都显示在列表框里面的函数
    Dim mrc As ADODB.Recordset
    Dim MsgText As String
    Dim txtSQL As String

    Dim i As Integer
        txtSQL = "select * from student_if"
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        With Me.MSFlexGrid1
        .Row = 1
    Do While Not mrc.EOF
            .Rows = .Rows + 1
            For i = 1 To mrc.Fields.Count
                Select Case mrc.Fields(i - 1).Type
                    Case adDBDate
                        .TextMatrix(.Rows - 2, i - 1) = Format(mrc.Fields(i - 1) & "", "yyyy-mm-dd")
                    Case Else
                        .TextMatrix(.Rows - 2, i - 1) = mrc.Fields(i - 1) & ""
                End Select
            Next i
            mrc.MoveNext
           
        Loop
        
        
        
    End With
    mrc.Close
     
     
     
End Sub

⌨️ 快捷键说明

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