(2010-12-15 20:08:24, Size: 401 B , Downloads: 89)
Dim num
Dim fid
Dim a()
Dim timu
Private Sub CommandButton1_Click()
timu = timu + 1
Call huanti(timu)
End Sub
Private Sub CommandButton2_Click()
pt = 0
If CheckBox1.Value = True Then pt = pt + 1
If CheckBox2.Value = True Then pt = pt + 2
If CheckBox3.Value = True Then pt = pt + 4
If CheckBox4.Value = True Then pt = pt + 8
If pt = Val(num) Then
MsgBox "恭喜你"
Else
MsgBox "真遗憾"
End If
End Sub
Private Sub CommandButton3_Click()
fid = FreeFile
i = 1
Open "多选.txt" For Input As fid
Do While Not EOF(fid)
ReDim Preserve a(i)
Line Input #fid, a(i)
i = i + 1
Loop
timu = 0
End Sub
Private Sub CommandButton4_Click()
timu = timu - 1
Call huanti(timu)
End Sub
Sub huanti(i)
If timu < 1 Then
MsgBox "前面没有题目了!"
timu = 1
Exit Sub
End If
If timu > UBound(a) Then
MsgBox "后面没有题目了!"
timu = UBound(a)
Exit Sub
End If
CheckBox1.Value = False
CheckBox2.Value = False
CheckBox3.Value = False
CheckBox4.Value = False
b = Split(a(i), " ")
Label1.Caption = b(0)
CheckBox1.Caption = b(1)
CheckBox2.Caption = b(2)
CheckBox3.Caption = b(3)
CheckBox4.Caption = b(4)
num = b(5)
End Sub
[ 本帖最后由 笨巧果 于 2010-12-15 22:25 编辑 ]
(18.2 KB, 下载次数: 102)
嘻嘻
第一个难道?
If A.Value = False And B.Value = True And C.Value = True And D.Value = False Then
MsgBox "正确!"
Else
If A.Value = True Or D.Value = True Then
MsgBox "错误!"
Else
MsgBox "没有选全面!"
End If
End If
End Sub
Dim fid
Dim ti()
Dim timu
Private Sub xyt_Click()
timu = timu + 1
Call huanti(timu)
End Sub
Private Sub tijiao_Click()
pt = 0
If a.Value = True Then pt = pt + 1
If B.Value = True Then pt = pt + 2
If C.Value = True Then pt = pt + 4
If D.Value = True Then pt = pt + 8
If pt = Val(num) Then
MsgBox "恭喜你"
Else
MsgBox "真遗憾"
End If
End Sub
Private Sub chushihua_Click()
fid = FreeFile
i = 1
Open "多选.txt" For Input As fid
Do While Not EOF(fid)
ReDim Preserve ti(i)
Line Input #fid, ti(i)
i = i + 1
Loop
timu = 0
End Sub
Private Sub syt_Click()
timu = timu - 1
Call huanti(timu)
End Sub
Sub huanti(i)
If i < 1 Then
MsgBox "前面没有题目了!"
i = 1
Exit Sub
End If
If i > UBound(ti) Then
MsgBox "后面没有题目了!"
timu = UBound(ti)
Exit Sub
End If
a.Value = False
B.Value = False
C.Value = False
D.Value = False
xx = Split(ti(i), " ")
tigan.Caption = xx(0)
a.Caption = xx(1)
B.Caption = xx(2)
C.Caption = xx(3)
D.Caption = xx(4)
num = xx(5)
End Sub
Private Sub CommandButton1_Click()
xz = 0
If Me.A = True Then xz = xz + 1
If Me.B = True Then xz = xz + 1
If Me.C = True Then xz = xz + 1
If Me.D = True Then xz = xz + 1
If xz = 2 Then
If Me.B = True And Me.C = True Then
MsgBox "完全正确"
GoTo 1
Else
If Me.B = True Or Me.C = True Then
MsgBox "部分正确,在想想!"
GoTo 1
End If
End If
End If
If Me.B = True Or Me.C = True Then
MsgBox "部分正确,在想想!"
Else
MsgBox "错误"
End If
1:
Me.A = False
Me.B = False
Me.C = False
Me.D = False
End Sub
我交作业了。
今晚学到了点VB。
我交作业了。
今晚学到了点VB。
26.4 KB, 下载次数: 64)
我交作业了。
今晚学到了点VB。
26.4 KB, 下载次数: 66)
果果老师,俺交作业喽----------
11.jpg
22.jpg
33.jpg
44.jpg
55.jpg
20.7 KB, 下载次数: 55)
(2010-12-16 00:11:16, Size: 30.5 KB, Downloads: 61)
代码
Dim num
Dim fid
Dim x()
Dim timu
Private Sub xyt_Click()
timu = timu + 1
Call huanti(timu)
End Sub
Private Sub tijiao_Click()
pt = 0
If A.Value = True Then pt = pt + 1
If B.Value = True Then pt = pt + 2
If C.Value = True Then pt = pt + 4
If D.Value = True Then pt = pt + 8
If pt = Val(num) Then
MsgBox "恭喜你"
Else
MsgBox "真遗憾"
End If
End Sub
Private Sub chushihua_Click()
fid = FreeFile
i = 1
Open "多选.txt" For Input As fid
Do While Not EOF(fid)
ReDim Preserve x(i)
Line Input #fid, x(i)
i = i + 1
Loop
timu = 0
End Sub
Private Sub syt_Click()
timu = timu - 1
Call huanti(timu)
End Sub
Sub huanti(i)
If timu < 1 Then
MsgBox "前面没有题目了!"
timu = 1
Exit Sub
End If
If timu > UBound(x) Then
MsgBox "后面没有题目了!"
timu = UBound(x)
Exit Sub
End If
A.Value = False
B.Value = False
C.Value = False
D.Value = False
e = Split(x(i), " ")
Label1.Caption = e(0)
A.Caption = e(1)
B.Caption = e(2)
C.Caption = e(3)
D.Caption = e(4)
num = e(5)
End Sub
212 KB, 下载次数: 43)
212 KB, 下载次数: 40)
感谢老师~
109 KB, 下载次数: 33)