TIP: Click on subject to list as thread! ANSI
echo: visual_basic
to: All
from: Uncle Whiplash
date: 2004-11-02 05:55:00
subject: Newbie Question Continued

To be more specific with my question:


I'm creating a bible trivia program, with a very simple gui.  Here is the
code I am working on.  Anyone got any tips to point me in the right
direction of better code?    Now I'm trying to figure out how to randomly
call the questions, but not call them twice in a row.

TIA 

Uncle

Dim QNum
Dim QCorrect
Dim QIncorrect
Dim NumCorrect
Dim NumIncorrect
Private Sub AnswerGen()

If QNum = 1 Then
   If Ans3.Value = True Then
      NumCorrect = NumCorrect + 1
   Else
      NumIncorrect = NumIncorrect + 1
   End If
End If
 
If QNum = 2 Then
   If Ans1.Value = True Then
     NumCorrect = NumCorrect + 1
   Else
       NumIncorrect = NumIncorrect + 1
   End If
End If
  
If QNum = 3 Then
   If Ans1.Value = True Then
      NumCorrect = NumCorrect + 1
   Else
       NumIncorrect = NumIncorrect + 1
     End If
End If
   
If QNum = 4 Then
   If Ans4.Value = True Then
      NumCorrect = NumCorrect + 1
   Else
       NumIncorrect = NumIncorrect + 1
   End If
End If
    
If QNum = 5 Then
   If Ans4.Value = True Then
     NumCorrect = NumCorrect + 1
Else
      NumIncorrect = NumIncorrect + 1
   End If
End If

Ans1.Value = False
Ans2.Value = False
Ans3.Value = False
Ans4.Value = False


TCorrect.Caption = NumCorrect
TIncorrect.Caption = NumIncorrect

QGen

End Sub

Private Sub cmdGo_Click()
AnswerGen
End Sub

Private Sub Command1_Click()
Form_Load
TCorrect.Caption = "0"
TIncorrect.Caption = "0"
GamePercent.Caption = "00%"
End Sub

Private Sub Form_Load()
QGen
NumCorrect = 0
NumIncorrect = 0
End Sub

Private Sub QGen()

Randomize
   Dim A
   A = Int((5 - 1 + 1) * Rnd + 1)
   Question = A
   Select Case Question
   
   Case 1
   
   txtQuestion.Text = "For _____ so loved the world that he gave his
only begotten son that whosoever believeth on him should not perish but
have everlasting life."
   Ans1.Caption = "James"
   Ans2.Caption = "Peter"
   Ans3.Caption = "God"
   Ans4.Caption = "Jesus"
   QNum = 1
   
   Case 2
   
   txtQuestion.Text = "According to the Old Testament, who was the
wisest person to ever live?"
   Ans1.Caption = "Solomon"
   Ans2.Caption = "Methusela"
   Ans3.Caption = "Moses"
   Ans4.Caption = "David"
      
   QNum = 2
   
   Case 3
   
   txtQuestion.Text = "What was Saul's wife's name?"
   Ans1.Caption = "Ahinoam"
   Ans2.Caption = "Ruth"
   Ans3.Caption = "Sarah"
   Ans4.Caption = "Sarai"
   
   QNum = 3
   
   Case 4
   QNum = 4
   txtQuestion.Text = "Who wrote the book of Ruth?"
   Ans1.Caption = "Boaz"
   Ans2.Caption = "Ruth"
   Ans3.Caption = "Naomi"
   Ans4.Caption = "Samuel"
      
   QNum = 4
   
   Case 5
   QNum = 5
   txtQuestion.Text = "Who cursed a fig tree for not bearing fruit?"
   Ans1.Caption = "Peter"
   Ans2.Caption = "Paul"
   Ans3.Caption = "Hezekiah"
   Ans4.Caption = "Jesus"
   
   QNum = 5
   
   End Select

End Sub
---
þ RIMEGate(tm)/RGXPost V1.14 at BBSWORLD * Info{at}bbsworld.com

---
 * RIMEGate(tm)V10.2áÿ* RelayNet(tm) NNTP Gateway * MoonDog BBS
 * RgateImp.MoonDog.BBS at 11/2/04 5:55:21 AM
* Origin: MoonDog BBS, Brooklyn,NY, 718 692-2498, 1:278/230 (1:278/230)
SEEN-BY: 633/267 270 5030/786
@PATH: 278/230 10/345 106/1 2000 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.