作者tang1019 (燢)
看板Visual_Basic
标题Re: [VB6 ] 帮忙一下,给我个提示吧!
时间Fri Feb 10 22:47:17 2006
用一个似的vb程式
文字档blue.txt放题目
out.txt答记录答题者之答案
随机选题的部份尚未考虑
如果你不知道FormA,FormB,FormTst上要放什麽
写信给我,我再告诉你
===============Module1==============
Public tot As Integer
Sub initialize()
FormA.Visible = False
FormTst.Visible = True
tot = 0
Open "blue.txt" For Input As #1
Open "out.txt" For Append As #2
End Sub
=========FormA============
Private Sub Form_KeyPress(KeyAscii As Integer)
initialize
End Sub
Private Sub Frame1_Click()
initialize
End Sub
Private Sub imgLogo_Click()
initialize
End Sub
==========FormB============
Private Sub cmdEnd_Click()
Close #1, #2
End
End Sub
Private Sub cmdOK_Click()
FormB.Visible = False
FormA.Visible = True
End Sub
Private Sub Form_Activate()
Label1.Caption = "您的分数是" + Str$(tot) + "分"
End Sub
==============FormTst==============
Private Sub Command1_Click()
ans = "0"
If Option1.Value = True Then
ans = "1"
tot = tot + 1
Option1.Value = False
End If
If Option2.Value = True Then
tot = tot + 2
ans = "2"
Option2.Value = False
End If
If Option3.Value = True Then
tot = tot + 3
ans = "3"
Option3.Value = False
End If
If Option4.Value = True Then
tot = tot + 4
ans = "4"
Option4.Value = False
End If
Print #2, ans;
If EOF(1) Then
Print #2, Right$(Space(4) + Str$(tot), 4);
Print #2, Space(2) + Date$ + Space(2) + Time$
Close #1, #2
FormTst.Visible = False
FormB.Visible = True
Else
Line Input #1, tmp
Label1.Caption = tmp
End If
End Sub
Private Sub Command2_Click()
Print #2, Space(4) + "NOT Completed"
Close #1, #2
FormTst.Visible = False
FormB.Visible = True
End Sub
Private Sub Form_Activate()
Label1.Font.Size = 20
Label1.BackColor = &HFF0000
Label1.ForeColor = &HFFFFFF
Option1.Caption = "极少(每周1天以下)"
Option2.Caption = "有时(每周1至2天)"
Option3.Caption = "时常(每周3至4天)"
Option4.Caption = "总是(每周5天以上)"
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
Line Input #1, tmp
Label1.Caption = tmp
End Sub
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.174.170.43
1F:→ tang1019:原po只是随便问问,我又何必当真呢? 02/13 09:05
2F:→ tang1019:随便的心态,是学不好程式的... 02/13 09:06