📄 frmaddsubject.frm
字号:
VERSION 5.00
Begin VB.Form FrmAddSubject
Caption = "题目入库"
ClientHeight = 6690
ClientLeft = 60
ClientTop = 345
ClientWidth = 9240
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 6690
ScaleWidth = 9240
StartUpPosition = 1 '所有者中心
Begin VB.Frame Frame1
Height = 150
Left = 405
TabIndex = 14
Top = 765
Width = 8520
End
Begin VB.CommandButton Command1
Caption = "取消"
Height = 375
Index = 1
Left = 6615
TabIndex = 13
Top = 5715
Width = 1320
End
Begin VB.CommandButton Command1
Caption = "入库"
Height = 375
Index = 0
Left = 5220
TabIndex = 12
Top = 5715
Width = 1320
End
Begin VB.ComboBox Combo1
Appearance = 0 'Flat
Height = 300
ItemData = "FrmAddSubject.frx":0000
Left = 1530
List = "FrmAddSubject.frx":0010
Style = 2 'Dropdown List
TabIndex = 11
Top = 5715
Width = 780
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 4
Left = 1395
TabIndex = 9
Top = 4365
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 3
Left = 1395
TabIndex = 7
Top = 3555
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 2
Left = 1395
TabIndex = 5
Top = 2745
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 1
Left = 1395
TabIndex = 3
Top = 1935
Width = 7260
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 780
Index = 0
Left = 1395
TabIndex = 1
Top = 1125
Width = 7260
End
Begin VB.Image Image1
Height = 480
Left = 540
Picture = "FrmAddSubject.frx":0020
Top = 180
Width = 480
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "正确答案为:"
Height = 180
Index = 5
Left = 405
TabIndex = 10
Top = 5760
Width = 1080
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案D:"
Height = 180
Index = 4
Left = 675
TabIndex = 8
Top = 4410
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案C:"
Height = 180
Index = 3
Left = 675
TabIndex = 6
Top = 3600
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案B:"
Height = 180
Index = 2
Left = 720
TabIndex = 4
Top = 2790
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "答案A:"
Height = 180
Index = 1
Left = 675
TabIndex = 2
Top = 1980
Width = 630
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "题目:"
Height = 180
Index = 0
Left = 675
TabIndex = 0
Top = 1170
Width = 540
End
End
Attribute VB_Name = "FrmAddSubject"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Rs As ADODB.Recordset
Private Sub Command1_Click(Index As Integer)
Dim rsq As ADODB.Recordset
Dim qMsg$
Dim SQL$
Select Case Index
Case 0
For i = 0 To Text1.Count - 1
If Text1(i).Text = Empty Then
MsgBox "请填写完整信息", vbInformation, "提示"
Text1(i).SetFocus
Exit Sub
End If
Next i
If Combo1.Text = Empty Then
MsgBox "请选择正确答案", vbInformation, "提示"
Combo1.SetFocus
Exit Sub
End If
DBName = ChoiceExerciseDB
SQL = "select * from ChoiceExercise Where Subject= '" & Text1(0).Text & "'"
Set rsq = executeSQL(SQL, qMsg, DBName)
If qMsg = "查询正确" Then
MsgBox "已经有此题目", vbInformation, "提示"
Set rsq = Nothing
Exit Sub
End If
Rs.AddNew
Rs.Fields(0) = Text1(0).Text
Rs.Fields(1) = Text1(1).Text
Rs.Fields(2) = Text1(2).Text
Rs.Fields(3) = Text1(3).Text
Rs.Fields(4) = Text1(4).Text
Rs.Fields(6) = JiaMi(Combo1.Text, Rs.RecordCount)
Rs.Fields(7) = Rs.RecordCount
Rs.Update
If MsgBox("题目添加成功,是否继续添加", vbInformation + vbYesNo, "成功") = vbYes Then
For i = 0 To Text1.Count - 1
Text1(i).Text = Empty
Next i
Combo1.Clear
Combo1.AddItem "A"
Combo1.AddItem "B"
Combo1.AddItem "C"
Combo1.AddItem "D"
'Set Rs = Nothing
Else
'Set Rs = Nothing
Unload Me
End If
Case 1
Me.Hide
End Select
End Sub
Private Sub Form_Load()
Dim Msg$
Dim SQL$
DBName = ChoiceExerciseDB
SQL = "select * from ChoiceExercise"
Set Rs = executeSQL(SQL, Msg, DBName)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -