?? 添加課程信息.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
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 + -