?? studentall.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 + -