📄 添加课程信息.frm
字号:
VERSION 5.00
Begin VB.Form Form7
Caption = "添加课程信息"
ClientHeight = 6480
ClientLeft = 60
ClientTop = 450
ClientWidth = 8910
LinkTopic = "Form7"
MDIChild = -1 'True
Picture = "添加课程信息.frx":0000
ScaleHeight = 6480
ScaleWidth = 8910
WindowState = 2 'Maximized
Begin VB.CommandButton cmdclear
BackColor = &H00C0C0C0&
Caption = "清 空"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4680
Style = 1 'Graphical
TabIndex = 6
Top = 4200
Width = 1335
End
Begin VB.CommandButton cmdexit
BackColor = &H00C0C0C0&
Caption = "退 出"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 2520
Style = 1 'Graphical
TabIndex = 5
Top = 4200
Width = 1455
End
Begin VB.CommandButton cmdadd
BackColor = &H00C0C0C0&
Caption = "添 加"
BeginProperty Font
Name = "宋体"
Size = 15
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 480
Style = 1 'Graphical
TabIndex = 4
Top = 4200
Width = 1335
End
Begin VB.TextBox txtcoursedir
BackColor = &H00E0E0E0&
Height = 975
Left = 2280
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 3
Top = 2640
Width = 2175
End
Begin VB.ComboBox cbocoursetype
BackColor = &H00E0E0E0&
Height = 300
Left = 2280
TabIndex = 2
Top = 1920
Width = 1935
End
Begin VB.TextBox txtcoursename
BackColor = &H00E0E0E0&
Height = 495
Left = 2280
TabIndex = 1
Top = 1200
Width = 2175
End
Begin VB.TextBox txtcourseid
BackColor = &H00E0E0E0&
Height = 495
Left = 2280
TabIndex = 0
Top = 360
Width = 2055
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "课程类型"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 495
Left = 360
TabIndex = 10
Top = 1920
Width = 1455
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "课程编号"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 495
Left = 360
TabIndex = 9
Top = 480
Width = 1455
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "课程名称"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 495
Left = 360
TabIndex = 8
Top = 1200
Width = 1215
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "课程描述"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 495
Left = 360
TabIndex = 7
Top = 2760
Width = 1335
End
End
Attribute VB_Name = "Form7"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdadd_Click()
Dim txtsql As String, mrc As Adodb.Recordset, msgtext As String
If Trim(txtcourseid.Text) = "" Then
FrmMain.StatusBarmy.Panels.Item(1).Text = "请输入课程编号!"
txtcourseid.SetFocus
Else: txtsql = "select * from course_info"
Set mrc = executesql(txtsql, msgtext)
While (mrc.EOF = False)
If Trim(mrc.Fields(0)) = Trim(txtcourseid.Text) Then
FrmMain.StatusBarmy.Panels.Item(1).Text = "该课程编号已存在,请重输!"
txtcourseid.SetFocus
Exit Sub
Else
mrc.MoveNext
End If
Wend
End If
If Trim(txtcoursename.Text) = "" Then
FrmMain.StatusBarmy.Panels.Item(1).Text = "请输入课程名称!"
txtcoursename.SetFocus
Else
txtsql = "select * from course_info"
Set mrc = executesql(txtsql, msgtext)
While (mrc.EOF = False)
If Trim(mrc.Fields(0)) = Trim(txtcoursename.Text) Then
FrmMain.StatusBarmy.Panels.Item(1).Text = "该课程名称已存在,请重输!"
txtcoursename.SetFocus
Exit Sub
Else
mrc.MoveNext
End If
Wend
End If
If Trim(cbocoursetype.Text) = "" Then
FrmMain.StatusBarmy.Panels.Item(1).Text = "请输入课程类型!"
cbocoursetype.SetFocus
Else
txtsql = "select * from course_info"
Set mrc = executesql(txtsql, msgtext)
While (mrc.EOF = False)
If Trim(mrc.Fields(0)) = Trim(cbocoursetype.Text) Then
FrmMain.StatusBarmy.Panels.Item(1).Text = "该课程类型已存在,请重输!"
cbocoursetype.SetFocus
Exit Sub
Else
mrc.MoveNext
End If
Wend
End If
If Trim(txtcoursedir.Text) = "" Then
FrmMain.StatusBarmy.Panels.Item(1).Text = "请输入课程描述!"
txtcoursedir.SetFocus
Else
txtsql = "select * from course_info"
Set mrc = executesql(txtsql, msgtext)
While (mrc.EOF = False)
If Trim(mrc.Fields(0)) = Trim(txtcoursedir.Text) Then
FrmMain.StatusBarmy.Panels.Item(1).Text = "该已课程描述存在,请重输!"
txtcoursedir.SetFocus
Exit Sub
Else
mrc.MoveNext
End If
Wend
End If
mrc.AddNew '添加新记录并写入表内
mrc.Fields(0) = Trim(txtcourseid.Text)
mrc.Fields(1) = Trim(txtcoursename.Text)
mrc.Fields(2) = Trim(cbocoursetype.Text)
mrc.Fields(3) = Trim(txtcoursedir.Text)
mrc.Update
mrc.Close
FrmMain.StatusBarmy.Panels.Item(1).Text = "添加成功!"
Exit Sub
End Sub
Private Sub cmdclear_Click()
txtcourseid.Text = ""
txtcoursename.Text = ""
cbocoursetype.Text = ""
txtcoursedir.Text = ""
End Sub
Private Sub cmdexit_Click()
Me.Hide
End Sub
Private Sub Form_Load()
cbocoursetype.AddItem ""
cbocoursetype.AddItem "考查课"
cbocoursetype.AddItem "公共课"
cbocoursetype.AddItem "选修课"
cbocoursetype.AddItem "专业课"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -