作者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
→ tang1019:原po只是隨便問問,我又何必當真呢? 02/13 09:05
→ tang1019:隨便的心態,是學不好程式的... 02/13 09:06