frmstuother.frm
来自「一款非常适合中小学教学任务不是很繁重的管理程序」· FRM 代码 · 共 430 行
FRM
430 行
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Object = "{E95A2510-F3D1-416D-823B-4F840FE98091}#3.0#0"; "Command.ocx"
Object = "{3A6644DE-3402-11D9-9DE7-C33FAA87690A}#1.0#0"; "WinXPCEngine.ocx"
Begin VB.Form frmStuOther
ClientHeight = 8385
ClientLeft = 60
ClientTop = 60
ClientWidth = 9675
ControlBox = 0 'False
LinkTopic = "Form1"
MDIChild = -1 'True
Picture = "frmStuOther.frx":0000
ScaleHeight = 8385
ScaleWidth = 9675
WindowState = 2 'Maximized
Begin WinXPC_Engine.WindowsXPC WindowsXPC1
Left = 2970
Top = 3870
_ExtentX = 6588
_ExtentY = 1085
ColorScheme = 2
Common_Dialog = 0 'False
End
Begin VB.ComboBox cboStudent
Height = 315
Left = 3960
Style = 2 'Dropdown List
TabIndex = 16
Top = 1170
Width = 2970
End
Begin MSFlexGridLib.MSFlexGrid mgridAll
Height = 3375
Left = 480
TabIndex = 14
Top = 4680
Width = 9015
_ExtentX = 15901
_ExtentY = 5953
_Version = 393216
FixedRows = 0
FixedCols = 0
End
Begin VB.TextBox txtSNo
Alignment = 2 'Center
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Index = 1
Left = 3960
MaxLength = 20
TabIndex = 13
Top = 3120
Width = 3015
End
Begin VB.TextBox txtName
Alignment = 2 'Center
Height = 405
Left = 3960
Locked = -1 'True
MaxLength = 20
TabIndex = 5
Top = 1800
Width = 3015
End
Begin VB.TextBox txtSNo
Alignment = 2 'Center
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Index = 0
Left = 3960
MaxLength = 20
TabIndex = 1
Top = 2400
Width = 3015
End
Begin CSCommand.Command cmdAdd
Height = 375
Left = 3120
TabIndex = 6
Top = 3960
Width = 975
_ExtentX = 1720
_ExtentY = 661
IconAlign = 0
Icon = "frmStuOther.frx":151DA4
Caption = "添加"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin CSCommand.Command cmdFind
Height = 375
Left = 1800
TabIndex = 7
Top = 3960
Width = 975
_ExtentX = 1720
_ExtentY = 661
IconAlign = 0
Icon = "frmStuOther.frx":151DC0
Caption = "查找"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin CSCommand.Command cmdExit
Height = 375
Left = 8400
TabIndex = 8
Top = 3960
Width = 975
_ExtentX = 1720
_ExtentY = 661
IconAlign = 0
Icon = "frmStuOther.frx":151DDC
Caption = "关闭"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin CSCommand.Command cmdDel
Height = 375
Left = 4440
TabIndex = 9
Top = 3960
Width = 975
_ExtentX = 1720
_ExtentY = 661
IconAlign = 0
Icon = "frmStuOther.frx":151DF8
Caption = "删除"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin CSCommand.Command cmdModiy
Height = 375
Left = 5760
TabIndex = 10
Top = 3960
Width = 975
_ExtentX = 1720
_ExtentY = 661
IconAlign = 0
Icon = "frmStuOther.frx":151E14
Caption = "修改"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin CSCommand.Command cmdPrint
Height = 375
Left = 7080
TabIndex = 11
Top = 3960
Width = 975
_ExtentX = 1720
_ExtentY = 661
IconAlign = 0
Icon = "frmStuOther.frx":151E30
Caption = "打印"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin CSCommand.Command cmdAll
Height = 375
Left = 480
TabIndex = 12
Top = 3960
Width = 975
_ExtentX = 1720
_ExtentY = 661
IconAlign = 0
Icon = "frmStuOther.frx":151E4C
Caption = "全部显示"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Label Label5
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "住宿情况"
BeginProperty Font
Name = "MS Sans Serif"
Size = 18
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Left = 4680
TabIndex = 15
Top = 360
Width = 1500
End
Begin VB.Label Label4
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "姓名"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00008000&
Height = 240
Left = 3120
TabIndex = 4
Top = 1920
Width = 360
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "宿舍号"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00008000&
Height = 255
Left = 3120
TabIndex = 3
Top = 3240
Width = 615
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "宿舍楼号"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00008000&
Height = 255
Left = 3000
TabIndex = 2
Top = 2520
Width = 735
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "学号(主键) "
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00008000&
Height = 255
Left = 3000
TabIndex = 0
Top = 1200
Width = 855
End
End
Attribute VB_Name = "frmStuOther"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim strSql As String
Dim RS As ADODB.Recordset
Private Sub cmdAdd_Click()
'添加
On Error Resume Next
If Trim(cboStudent.Text) <> "" Then
strSql = "insert into 学生住宿表 values('" & Trim(Me.cboStudent.Text) & "',"
strSql = strSql & Val(Trim(txtSNo(0).Text))
strSql = strSql & "," & Val(Trim(txtSNo(1).Text)) & ")"
dbOperate strSql
Else
MsgBox "主键不能为空", vbOKOnlyvbok + vbExclamation, "提示"
End If
End Sub
Private Sub cmdAll_Click()
'全部显示
On Error Resume Next
strSql = "select 学生基本情况表.学号,学生基本情况表.姓名,"
strSql = strSql & "学生住宿表.住宿楼号,学生住宿表.宿舍号"
strSql = strSql & " from 学生基本情况表,学生住宿表 where"
strSql = strSql & " 学生基本情况表.学号=学生住宿表.学号"
writeMS strSql, Me.mgridAll
End Sub
Private Sub cmdDel_Click()
'删除
On Error Resume Next
If Trim(cboStudent.Text) <> "" Then
strSql = "delete from 学生住宿表 where"
strSql = strSql & " 学号='" & Trim(cboStudent.Text) & "'"
dbOperate strSql
Else
MsgBox "主键不能为空", vbOKOnlyvbok + vbExclamation, "提示"
End If
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdFind_Click()
'查找
On Error Resume Next
If Trim(txtNo.Text) <> "" Then
strSql = "select 学生基本情况表.学号,学生基本情况表.姓名,"
strSql = strSql & "学生住宿表.住宿楼号,学生住宿表.宿舍号"
strSql = strSql & " from 学生基本情况表,学生住宿表 where"
strSql = strSql & " 学生住宿表.学号='" & Trim(Me.cboStudent.Text) & "'"
strSql = strSql & " and 学生基本情况表.学号=学生住宿表.学号"
writeMS strSql, Me.mgridAll
Set RS = dbSelect(strSql)
Call clearAll
txtNo.Text = RS.Fields(0)
txtName.Text = RS.Fields(1)
txtSNo(0).Text = RS.Fields(2)
txtSNo(1).Text = RS.Fields(3)
Set RS = Nothing
Else
MsgBox "主键不能为空", vbOKOnlyvbok + vbExclamation, "提示"
End If
End Sub
Private Sub cmdModiy_Click()
'修改
cmdDel_Click
cmdAdd_Click
End Sub
Private Sub cmdPrint_Click()
writeMSFlexGrid Me.mgridAll, "住宿表"
End Sub
Sub clearAll()
txtName.Text = ""
txtSNo(0).Text = ""
txtSNo(1).Text = ""
End Sub
Private Sub Form_Load()
On Error Resume Next
strSql = "select 学号 from 学生基本情况表"
Set RS = dbSelect(strSql)
While Not RS.EOF
Me.cboStudent.AddItem RS.Fields(0)
RS.MoveNext
Wend
Me.cboStudent.ListIndex = 0
Me.WindowsXPC1.InitSubClassing
End Sub
Private Sub txtSNo_KeyPress(Index As Integer, KeyAscii As Integer)
If Not IsNumeric(Trim(txtSNo(Index).Text)) Then
MsgBox "在楼号和住宿号只能输入数字!", vbOKOnly + vbExclamation, "提示"
End If
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?