📄 frmgbj.frm
字号:
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
ColumnWidth = 1244.976
EndProperty
BeginProperty Column01
ColumnWidth = 1709.858
EndProperty
EndProperty
End
Begin MSDataGridLib.DataGrid DataGrid2
Height = 3495
Left = -74880
TabIndex = 8
Top = 360
Width = 3375
_ExtentX = 5953
_ExtentY = 6165
_Version = 393216
AllowUpdate = -1 'True
HeadLines = 1
RowHeight = 15
FormatLocked = -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 = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "已有班级"
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
ColumnWidth = 1244.976
EndProperty
BeginProperty Column01
ColumnWidth = 1709.858
EndProperty
EndProperty
End
Begin VB.Label Label2
Caption = "请输入班级名称"
BeginProperty Font
Name = "楷体_GB2312"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3720
TabIndex = 3
Top = 1440
Width = 2175
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "请选择专业"
BeginProperty Font
Name = "楷体_GB2312"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 3840
TabIndex = 1
Top = 720
Width = 1500
End
End
End
Attribute VB_Name = "Frmgbj"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub combo()
Combo1.clear
Combo1.Text = "请选择"
Adodc2.RecordSource = "select * from 专业 "
Adodc2.Refresh
With Adodc2.Recordset
.MoveFirst
Do While Not .EOF
Combo1.AddItem .Fields(0)
.MoveNext
Loop
End With
End Sub
Private Sub Command1_Click()
If Combo1.Text = "请选择" Then
MsgBox "请选择专业", vbOKOnly, "提示"
Exit Sub
End If
If Text1.Text = "" Then
MsgBox "请输入您要添加的班级名称", vbOKOnly, "提示"
Call FocusBack(Text1)
Exit Sub
End If
Adodc1.RecordSource = "select * from 班级 where 班级名称='" & Text1.Text & "'"
Adodc1.Refresh
With Adodc1.Recordset
If .EOF Then
.AddNew
.Fields(0) = Text1.Text
.Fields(1) = Combo1.Text
.UpdateBatch
Adodc1.RecordSource = "select * from 班级"
Adodc1.Refresh
MsgBox "添加班级成功", vbOKOnly, "提示"
Combo1.Text = "请选择"
Text1.Text = ""
Else
MsgBox "该班级已经存在", vbOKOnly, "提示"
Call FocusBack(Text1)
Exit Sub
End If
End With
Adodc1.RecordSource = "select * from 班级"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Command3_Click()
Dim Myexit As Integer
Dim strSQL As String
strSQL = "删除该班级将会删除该班级中所有的学生" & vbCr & "你确定删除班级“" & Adodc1.Recordset("班级名称") & "”吗?"
Myexit = MsgBox(strSQL, vbQuestion + vbYesNo + vbDefaultButton2, "询问")
If Myexit = vbYes Then
Adodc1.Recordset.Delete
End If
Command4.Enabled = True
End Sub
Private Sub Command4_Click()
Adodc1.Recordset.CancelBatch
Adodc1.Refresh
End Sub
Private Sub Command5_Click()
Adodc1.Recordset.UpdateBatch
Unload Me
End Sub
Private Sub Form_Load()
SSTab1.Tab = 0
Call combo
Adodc1.CommandType = adCmdText
Adodc1.RecordSource = "select * from 班级 order by 专业名称"
Adodc1.Refresh
Set DataGrid1.DataSource = Adodc1
Set DataGrid2.DataSource = Adodc1
Command4.Enabled = False
End Sub
Private Sub Form_Initialize()
ChDrive App.Path
ChDir App.Path
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -