• Welcome to Valhalla Legends Archive.
 

Help...again

Started by Reaper~, December 21, 2004, 11:48 PM

Previous topic - Next topic

Reaper~


Private Sub cmdGo_Click()
If txtBet.Text = "" Then
MsgBox ("Please place a bet")
Unload Me
frmPickANumber.Show
End If
lblAnswer.Caption = "And the number is..."
lblNumber.Caption = Rand(1, 25)
If txtNumber.Text = lblNumber.Caption Then
MsgBox ("Mega-Winner!! $500 has been sent to your account!")
frmAccount.lblWinning1.Caption = "$500"
frmAccount.lblWinning1.Enabled = False
End If
Else
MsgBox ("Ouch Sorry!")
frmAccount.lblWinning1.Caption = txtBet.Text
frmAccount.lblWinning1.FontStrikethru = True
End If
End Sub


I want to make it so that if the guess is in range of the number by 5 it would give like $200 or something. Ex.  The random number is 15, if the person guessed 12, they're in range by 5, so they get some money.
I'm not sure how to go about this though?
Take my advice, I'm not using it.

Hdx


If Val(txtNumber.Text) = Val(lblNumber.Caption)  then 'Right on the dot
ElseIf (Val(txtNumber.Text) <= Val(lblNumber.Caption) + 5) And (Val(txtNumber.Text) >= Val(lblNumber.Caption) - 5) Then '5 away
ElseIf (Val(txtNumber.Text) <= Val(lblNumber.Caption) + 10) And (Val(txtNumber.Text) >= Val(lblNumber.Caption) - 10) Then '10 away
Else 'Not Even Close
End if

Try that..
~-~(HDX)~-~

Proud host of the JBLS server www.JBLS.org.
JBLS.org Status:
JBLS/BNLS Server Status

Reaper~

Works like a charm, thanks :D
Take my advice, I'm not using it.