|
-
Apr 29th, 2005, 10:49 AM
#1
Thread Starter
New Member
family feud
I am trying to create a small family feud game with vb 6.0. Can anyone help try to make this snippet of the code work. The purpose is to check to see if the string in text matches if it doesn't you have 3 chances to get the correct answer. Once count is = to 3 then it should tell you that you have lost. For some reason it is not working. Any help would greatly be appreciated.
Do While count <> 3
If Text1 = "cat" Then
resp = MsgBox("yeah", vbInformation)
Else
resp2 = MsgBox("try again", vbOKOnly)
count = count + 1
Text1 = ""
End If
Loop
If count = 3 Then resp3 = MsgBox("lose", vbOKCancel)
End Sub
-
Apr 29th, 2005, 11:04 AM
#2
New Member
Re: family feud
remove Text1 = "" from your Do While loop, it's not needed.
After the Loop use If count >= 3 ...
Not sure if that'll solve your problem, but it'll make for better code.
-
Apr 29th, 2005, 02:59 PM
#3
Fanatic Member
Re: family feud
i dont think you should use a loop. it will not giver a user time to type. it will just pop up 3 message box's right away.
-
May 2nd, 2005, 09:16 AM
#4
Thread Starter
New Member
Re: family feud
if i don't use a loop How would i count how many times they entered a wrong answer before losing the game
-
May 2nd, 2005, 11:16 AM
#5
New Member
Re: family feud
Using a loop is fine, just in your loop there is no code to take input from the user, so in this example it would immediately execute the loop 3 times.
-
May 2nd, 2005, 12:58 PM
#6
Re: family feud
<I moved the thread, since there was no demo in the thread>
-
May 3rd, 2005, 09:32 AM
#7
Thread Starter
New Member
Re: family feud
where exactly did you move the thread to?
-
May 3rd, 2005, 09:37 AM
#8
Thread Starter
New Member
Re: family feud
I think i found the solution. Take a look at this snippet and let me know what you think
If txtAnswer1.Text = "cat" Then
num1 = 28
lblAnswer1 = num1
retval = PlaySound("C:\gong.wav", 1)
ElseIf txtAnswer1.Text <> "cat" Then
Do While count <> 3
txtAnswer1.Text = InputBox("PLEASE RE-ENTER ANSWER")
retval1 = PlaySound("C:\buzzer.wav", 1)
count = count + 1
MsgBox (count)
Loop
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|