📄 formclass2.frm
字号:
NumButtonMenus = 2
BeginProperty ButtonMenu1 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "dang"
Text = "打印当前记录"
EndProperty
BeginProperty ButtonMenu2 {66833FEE-8583-11D1-B16A-00C0F0283628}
Key = "all"
Text = "打印全部记录"
EndProperty
EndProperty
EndProperty
EndProperty
End
End
Begin MSComctlLib.ImageList ImageList1
Left = 2880
Top = 2400
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 5
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Formclass2.frx":0BC6
Key = "del"
EndProperty
BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Formclass2.frx":101E
Key = "print"
EndProperty
BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Formclass2.frx":169A
Key = "find"
EndProperty
BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Formclass2.frx":1AEE
Key = "modi"
EndProperty
BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "Formclass2.frx":1F42
Key = "class"
Object.Tag = "class"
EndProperty
EndProperty
End
End
Attribute VB_Name = "Formclass2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public printstr As String
Public Sub classshowtitle()
Dim i As Integer
MSF1.Clear
With MSF1
.Cols = 8
.TextMatrix(0, 1) = "年级"
.TextMatrix(0, 2) = "班级"
.TextMatrix(0, 3) = "教室"
.TextMatrix(0, 4) = "年制"
.TextMatrix(0, 5) = "系别"
.TextMatrix(0, 6) = "班主任"
.ColWidth(0) = 100
.ColWidth(1) = 1300
.ColWidth(2) = 1200
.ColWidth(3) = 800
.ColWidth(4) = 800
.ColWidth(5) = 800
.ColWidth(6) = 800
.FixedRows = 1
For i = 1 To 7
.ColAlignment(i) = 0
Next i
.FillStyle = flexFillSingle
.Col = 0
.Row = 0
.RowSel = 1
.ColSel = .Cols - 1
.CellAlignment = 4
.Row = 1
End With
End Sub
Public Sub classshowdata()
Dim j As Integer
Dim i As Integer
Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
msql = ql()
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = msql
Adodc1.Refresh
If Adodc1.Recordset.EOF = False Then
Adodc1.Recordset.MoveFirst
With MSF1
.Rows = 50
.Row = 1
Do While Not Adodc1.Recordset.EOF
.Rows = .Rows + 1
For i = 1 To Adodc1.Recordset.Fields.Count
.TextMatrix(.Row, i) = Adodc1.Recordset.Fields(i - 1)
Next i
.Row = .Row + 1
Adodc1.Recordset.MoveNext
Loop
End With
Else
If classfind = True Then
Formclass2.Hide
Formclass3.Show
MsgBox "对不起,没有此班级的档案记录!", vbOKOnly, "查询"
Formclass3.ZOrder (0)
Formclass3.Text1(0).SetFocus
End If
End If
End Sub
Private Sub Form_Activate()
If classfind = True Then
Formclass3.ZOrder 0
End If
If classfind = True Then
Exit Sub
ElseIf classmodi = True Then
classshowdata
' classmodi = False
Else
classtree
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
If classfind = True Then
classfind = False
Formclass3.Text1(0).SetFocus
End If
End Sub
Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
Select Case Button.Tag
Case "find"
Formclass3.Show
Case "modi"
mqx = qx()
If mqx = "user" Then
ss = MsgBox("对不起,你是普通用户不能修改记录,请与管理员联系!", vbInformation + vbOKOnly, " 警告")
Exit Sub
End If
Formclass4.Show
Formclass4.ZOrder 0
Case "del"
mqx = qx()
If mqx = "user" Then
ss = MsgBox("对不起,你是普通用户不能修改记录,请与管理员联系!", vbInformation + vbOKOnly, " 警告")
Exit Sub
End If
Formclass4.Show
Formclass4.ZOrder 0
End Select
End Sub
Public Sub classtree()
TreeView1.Nodes.Clear
Dim nodex As Node
Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
sql = "select * from class"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = sql
Adodc1.Refresh
Dim a As String
a = "年级"
TreeView1.LineStyle = tvwRootLines
sql = "select distinct grd from class order by grd"
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = sql
Adodc1.Refresh
Adodc2.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
sql = "select distinct grd,class from class order by grd,class"
Adodc2.CommandType = adCmdText
Adodc2.RecordSource = sql
Adodc2.Refresh
Adodc1.Recordset.MoveFirst
Do Until Adodc1.Recordset.EOF
Adodc2.Recordset.MoveFirst
Set nodex = TreeView1.Nodes.add(, , a, Adodc1.Recordset.Fields(0), 1, 1)
Do While Not Adodc2.Recordset.EOF
If Adodc2.Recordset.Fields(0) = Adodc1.Recordset.Fields(0) Then
Set nodex = TreeView1.Nodes.add(a, tvwChild, , Adodc2.Recordset.Fields(1), 2, 2)
End If
Adodc2.Recordset.MoveNext
Loop
a = a & "1"
Adodc1.Recordset.MoveNext
Loop
Adodc2.Recordset.Close
Adodc1.Recordset.Close
Adodc1.Refresh
Adodc2.Refresh
End Sub
Private Sub Toolbar1_ButtonMenuClick(ByVal ButtonMenu As MSComctlLib.ButtonMenu)
Select Case ButtonMenu.Key
Case "dang"
If Trim(printstr) = "" Then
MsgBox "没有当前记录!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
If DataEnv1.rsCommand2.State = adStateOpen Then
DataEnv1.rsCommand2.Close
End If
DataEnv1.rsCommand2.Open printstr
If DataEnv1.rsCommand2.EOF = True Then
MsgBox "没有当前记录!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
DataReportclass.Show 1
Case "all"
If DataEnv1.rsCommand2.State = adStateOpen Then
DataEnv1.rsCommand2.Close
End If
DataEnv1.rsCommand2.Open ("select * from class")
If DataEnv1.rsCommand2.EOF = True Then
MsgBox "没有当前记录!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
DataReportclass.Show 1
End Select
End Sub
Private Sub TreeView1_DblClick()
On Error GoTo ss
If TreeView1.SelectedItem.Index = 0 Then
MSF1.Clear
Exit Sub
End If
sql = TreeView1.Nodes.Item(TreeView1.SelectedItem.Index)
sql = " select * from class where grd='" & Trim(sql) & "' or class='" & Trim(sql) & "' order by grd,class "
printstr = sql
Me.Caption = "浏览班级"
Me.classshowtitle
Me.classshowdata
Exit Sub
ss:
MSF1.Clear
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -