📄 main.frm
字号:
VERSION 5.00
Begin VB.Form main
BorderStyle = 3 'Fixed Dialog
ClientHeight = 2760
ClientLeft = 45
ClientTop = 330
ClientWidth = 5730
Icon = "main.frx":0000
LinkTopic = "Form2"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2760
ScaleWidth = 5730
ShowInTaskbar = 0 'False
StartUpPosition = 2 '屏幕中心
Begin VB.CommandButton cmdok
Height = 375
Left = 3765
Style = 1 'Graphical
TabIndex = 5
TabStop = 0 'False
Top = 1785
Width = 1110
End
Begin VB.CommandButton Command2
Enabled = 0 'False
Height = 375
Left = 750
Style = 1 'Graphical
TabIndex = 3
TabStop = 0 'False
Top = 1785
Width = 1095
End
Begin VB.CommandButton Command1
Default = -1 'True
Height = 375
Left = 2325
Style = 1 'Graphical
TabIndex = 4
Top = 1800
Width = 1095
End
Begin VB.Frame Frame1
BorderStyle = 0 'None
Caption = "Frame1"
Height = 1380
Left = 195
TabIndex = 6
Top = 195
Width = 5430
Begin VB.OptionButton Option1
Height = 255
Index = 3
Left = 930
TabIndex = 0
Top = 900
Width = 990
End
Begin VB.OptionButton Option1
Height = 255
Index = 1
Left = 2145
TabIndex = 1
Top = 930
Width = 975
End
Begin VB.OptionButton Option1
Height = 255
Index = 2
Left = 3660
TabIndex = 2
Top = 915
Width = 900
End
Begin VB.Label labmain
AutoSize = -1 'True
BackStyle = 0 'Transparent
Height = 180
Left = 900
TabIndex = 8
Top = 300
Width = 90
End
Begin VB.Label labid
BackStyle = 0 'Transparent
Height = 255
Left = 360
TabIndex = 7
Top = 300
Width = 375
End
End
Begin VB.Frame Frame2
BorderStyle = 0 'None
Height = 1290
Left = 135
TabIndex = 9
Top = 255
Visible = 0 'False
Width = 5400
Begin VB.TextBox Text2
Appearance = 0 'Flat
Height = 285
Left = 810
TabIndex = 11
Top = 780
Width = 4500
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 300
Left = 810
TabIndex = 10
Top = 225
Width = 4485
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Height = 195
Left = 135
TabIndex = 13
Top = 870
Width = 645
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Height = 195
Left = 135
TabIndex = 12
Top = 285
Width = 840
End
End
End
Attribute VB_Name = "main"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim wtid As Long
Dim Str1 As String
Dim abc(130) As Byte
Dim RsB As New ADODB.Recordset
Private Sub cmdok_Click()
Dim i As Long
Dim j As Long
If cmdok.Caption = "退 出" Then
StrJG = ""
Unload Me
Else
If Text1.Text = "" Or Text2.Text = "" Then MsgBox "请填写长短处 ", vbInformation: Exit Sub
Dim RsC As New ADODB.Recordset
For i = 1 To 130 '将答案转为字符串
j = abc(i)
If j = 0 Then Exit For
If i > 91 And j <> 2 Then
If j = 1 Then
abc(i) = 3
Else
abc(i) = 1
End If
End If
StrJG = StrJG & (abc(i) - 1)
Next
UserN = Form1.Text1(0).Text
UserS = Form1.Text1(1).Text
UserA = Form1.Text1(2).Text
UserL = Form1.Text1(3).Text
UserD = Form1.Text1(4).Text
UserT = Form1.Text1(5).Text
UserCC = Text1.Text
UserDC = Text2.Text
RsC.Open "select * from user1", Conn, 3, 3
RsC.AddNew
For i = 0 To 5
If Form1.Text1(i).Text <> "" Then RsC.Fields(i).Value = Form1.Text1(i).Text
Form1.Text1(i).Text = ""
Next
RsC.Fields(6).Value = StrJG
RsC.Fields(7).Value = Text1.Text
RsC.Fields(8).Value = Text2.Text
RsC.Update
RsC.Close
Set RsC = Nothing
Call Form1.CSJG
Unload Me
End If
End Sub
Private Sub Command1_Click()
Dim i As Long
Dim j As Long
If Option1(1) Then i = 1
If Option1(2) Then i = 2
If Option1(3) Then i = 3
If i = 0 Then MsgBox "请答题! ", vbInformation: Exit Sub
j = abc(wtid)
If j <> i Then abc(wtid) = 2
If j = 0 Then abc(wtid) = i
If wtid >= 130 Then
Command1.Enabled = False
cmdok.Caption = "完 成"
Frame1.Visible = False
Frame2.Visible = True
Else
wtid = wtid + 1
labid.Caption = wtid
RsB.MoveNext
labmain.Caption = RsB.Fields(0).Value
If abc(wtid) = 0 Then
Option1(3).SetFocus
Option1(3).Value = False
Else
Option1(abc(wtid)).Value = True
Option1(abc(wtid)).SetFocus
End If
If wtid > 1 Then Command2.Enabled = True
End If
End Sub
Private Sub Command2_Click()
Dim i As Long
Dim j As Long
If Option1(1) Then i = 1
If Option1(2) Then i = 2
If Option1(3) Then i = 3
If Command1.Enabled Then
j = abc(wtid)
If j <> i Then abc(wtid) = 2
If j = 0 Then abc(wtid) = i
RsB.MovePrevious
wtid = wtid - 1
Else
RsB.MoveLast
End If
labmain.Caption = RsB.Fields(0).Value
If Not RsB.EOF Then
Frame1.Visible = True
Command1.Enabled = True
cmdok.Caption = "退 出"
End If
labid.Caption = wtid
If wtid <= 1 Then Command2.Enabled = False ': Exit Sub
If abc(wtid) = 0 Then
Option1(2).Value = True
Option1(2).SetFocus
Else
Option1(abc(wtid)).Value = True
Option1(abc(wtid)).SetFocus
End If
End Sub
Private Sub Form_Activate()
Option1(3).SetFocus
Option1(3).Value = False
End Sub
'初始化
Private Sub Form_Load()
Dim i As Long
RsB.Open "select * from wenti", Conn, 1, 1
Me.Caption = "答题"
Option1(1).Caption = "不是"
Option1(2).Caption = "不知道"
Option1(3).Caption = "是"
Command1.Caption = "下一题"
Command2.Caption = "上一题"
cmdok.Caption = "退 出"
Label1.Caption = "长处:"
Label2.Caption = "短处:"
For i = 0 To 130
abc(i) = 0
Next
StrJG = ""
wtid = 1
labid.Caption = wtid
labmain.Caption = RsB.Fields(0).Value
End Sub
Private Sub Form_Unload(Cancel As Integer)
RsB.Close
Set RsB = Nothing
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -