# Need urgent help plz

Hi everyone i need sum urgent help quick plz
how do i make the number for lblNum2 to always be smaller then lblNum1 so the answer is never a decimal
Private Sub cmdNext_Click()
Dim Number1 As Integer
Dim Number2 As Integer
lblMessage.Caption = ""
NumProb = NumProb + 1
Number1 = Int(Rnd * 20)
Number2 = Int(Rnd * 20)
lblNum1.Caption = Format(Number1, "#0")
lblNum2.Caption = Format(Number2, "#0")
'Find sum
sum = Number1 / Number2
cmdNext.Enabled = False
End Sub

mark

• Number1 = Int(Rnd * 20)
Number2 = Int(Rnd * 20)

do while number2 > number1
Number2 = Int(Rnd * 20)
loop

[b]Regards
Er. [blue]Gurpreet Singh [/blue](B.E [blue]Mech.)[/blue][/b]
[hr]

• : Number1 = Int(Rnd * 20)
: Number2 = Int(Rnd * 20)
:
: do while number2 > number1
: Number2 = Int(Rnd * 20)
: loop
:
Maybe it'd be more efficient to just swap them over if they're not as we want...

[code]If Number2 > Number1 Then
Dim temp as Long
temp = Number1
Number1 = Number2
Number2 = temp
End If[/code]

Jonathan

###
for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
(tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
/(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");

• : : Number1 = Int(Rnd * 20)
: : Number2 = Int(Rnd * 20)
: :
: : do while number2 > number1
: : Number2 = Int(Rnd * 20)
: : loop
: :
: Maybe it'd be more efficient to just swap them over if they're not as we want...
:
: [code]If Number2 > Number1 Then
: Dim temp as Long
: temp = Number1
: Number1 = Number2
: Number2 = temp
: End If[/code]
:
: Jonathan
:
: ###
: for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
:

thanks but after doing the above it has come up with this line
sum = Number1 / Number2
as having and error wot could it be
from
mark
• : : Number1 = Int(Rnd * 20)
: : Number2 = Int(Rnd * 20)
: :
: : do while number2 > number1
: : Number2 = Int(Rnd * 20)
: : loop
: :
: Maybe it'd be more efficient to just swap them over if they're not as we want...
:
: [code]If Number2 > Number1 Then
: Dim temp as Long
: temp = Number1
: Number1 = Number2
: Number2 = temp
: End If[/code]
:
: Jonathan
:
: ###
: for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
:
:
and by the way this happens on both methords
from
mark
• : : : Number1 = Int(Rnd * 20)
: : : Number2 = Int(Rnd * 20)
: : :
: : : do while number2 > number1
: : : Number2 = Int(Rnd * 20)
: : : loop
: : :
: : Maybe it'd be more efficient to just swap them over if they're not as we want...
: :
: : [code]If Number2 > Number1 Then
: : Dim temp as Long
: : temp = Number1
: : Number1 = Number2
: : Number2 = temp
: : End If[/code]
: :
: : Jonathan
: :
: : ###
: : for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: : (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: : /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
: :
:
: thanks but after doing the above it has come up with this line
: sum = Number1 / Number2
: as having and error wot could it be
: from
: mark
:
It's due to the position of the planet Mars. You may also find your program won't work on some Thursday afternoons.

Uh...I mean...post the error message, or we really have no clue.

Jonathan

###
for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
(tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
/(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");

• : : : : Number1 = Int(Rnd * 20)
: : : : Number2 = Int(Rnd * 20)
: : : :
: : : : do while number2 > number1
: : : : Number2 = Int(Rnd * 20)
: : : : loop
: : : :
: : : Maybe it'd be more efficient to just swap them over if they're not as we want...
: : :
: : : [code]If Number2 > Number1 Then
: : : Dim temp as Long
: : : temp = Number1
: : : Number1 = Number2
: : : Number2 = temp
: : : End If[/code]
: : :
: : : Jonathan
: : :
: : : ###
: : : for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: : : (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: : : /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
: : :
: :
: : thanks but after doing the above it has come up with this line
: : sum = Number1 / Number2
: : as having and error wot could it be
: : from
: : mark
: :
: It's due to the position of the planet Mars. You may also find your program won't work on some Thursday afternoons.
:
: Uh...I mean...post the error message, or we really have no clue.
:
: Jonathan
:
: ###
: for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
:
:
i get a few on is run time error '11' division by zero
then another one is run time error '6' overflow
and thats about it really and also how do i make it so after i type the answer in the text box and click enter how do i make it so i cannot type in the text box until the next question cums up
from
mark
• : : : : : Number1 = Int(Rnd * 20)
: : : : : Number2 = Int(Rnd * 20)
: : : : :
: : : : : do while number2 > number1
: : : : : Number2 = Int(Rnd * 20)
: : : : : loop
: : : : :
: : : : Maybe it'd be more efficient to just swap them over if they're not as we want...
: : : :
: : : : [code]If Number2 > Number1 Then
: : : : Dim temp as Long
: : : : temp = Number1
: : : : Number1 = Number2
: : : : Number2 = temp
: : : : End If[/code]
: : : :
: : : : Jonathan
: : : :
: : : : ###
: : : : for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: : : : (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: : : : /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
: : : :
: : :
: : : thanks but after doing the above it has come up with this line
: : : sum = Number1 / Number2
: : : as having and error wot could it be
: : : from
: : : mark
: : :
: : It's due to the position of the planet Mars. You may also find your program won't work on some Thursday afternoons.
: :
: : Uh...I mean...post the error message, or we really have no clue.
: :
: : Jonathan
: :
: : ###
: : for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: : (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: : /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
: :
: :
: i get a few on is run time error '11' division by zero
Ah, OK. That's because your numbers could be zero. Try something more like:-
Number1 = 1 + Int(Rnd * 20)
Number2 = 1 + Int(Rnd * 20)
Instead so it can never be zero.

: then another one is run time error '6' overflow
Overflow? Hmmmm....I can't think how you'd manage that, given you only have integers between 1 and 20! What values are going in when you get the overflow error (e.g. what are Number1 and Number2)?

: and thats about it really and also how do i make it so after i type
: the answer in the text box and click enter how do i make it so i
: cannot type in the text box until the next question cums up
:
TextBox.Enabled = False ' To stop people typing in it
TextBox.Enabled = True ' To allow people to type in it again

Jonathan

###
for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
(tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
/(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");

• : : : : : : Number1 = Int(Rnd * 20)
: : : : : : Number2 = Int(Rnd * 20)
: : : : : :
: : : : : : do while number2 > number1
: : : : : : Number2 = Int(Rnd * 20)
: : : : : : loop
: : : : : :
: : : : : Maybe it'd be more efficient to just swap them over if they're not as we want...
: : : : :
: : : : : [code]If Number2 > Number1 Then
: : : : : Dim temp as Long
: : : : : temp = Number1
: : : : : Number1 = Number2
: : : : : Number2 = temp
: : : : : End If[/code]
: : : : :
: : : : : Jonathan
: : : : :
: : : : : ###
: : : : : for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: : : : : (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: : : : : /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
: : : : :
: : : :
: : : : thanks but after doing the above it has come up with this line
: : : : sum = Number1 / Number2
: : : : as having and error wot could it be
: : : : from
: : : : mark
: : : :
: : : It's due to the position of the planet Mars. You may also find your program won't work on some Thursday afternoons.
: : :
: : : Uh...I mean...post the error message, or we really have no clue.
: : :
: : : Jonathan
: : :
: : : ###
: : : for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: : : (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: : : /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
: : :
: : :
: : i get a few on is run time error '11' division by zero
: Ah, OK. That's because your numbers could be zero. Try something more like:-
: Number1 = 1 + Int(Rnd * 20)
: Number2 = 1 + Int(Rnd * 20)
: Instead so it can never be zero.
:
: : then another one is run time error '6' overflow
: Overflow? Hmmmm....I can't think how you'd manage that, given you only have integers between 1 and 20! What values are going in when you get the overflow error (e.g. what are Number1 and Number2)?
:
: : and thats about it really and also how do i make it so after i type
: : the answer in the text box and click enter how do i make it so i
: : cannot type in the text box until the next question cums up
: :
: TextBox.Enabled = False ' To stop people typing in it
: TextBox.Enabled = True ' To allow people to type in it again
:
: Jonathan
:
: ###
: for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
yo well the over flow thing does not seem to happen any more thanks and the no zero thing cums up any more thatnks for that mate
but now the text box thing aint working though cos it still lets me type in it after i have hit eneter for the correct answer to be displayed
from
mark

• : : : : : : : Number1 = Int(Rnd * 20)
: : : : : : : Number2 = Int(Rnd * 20)
: : : : : : :
: : : : : : : do while number2 > number1
: : : : : : : Number2 = Int(Rnd * 20)
: : : : : : : loop
: : : : : : :
: : : : : : Maybe it'd be more efficient to just swap them over if they're not as we want...
: : : : : :
: : : : : : [code]If Number2 > Number1 Then
: : : : : : Dim temp as Long
: : : : : : temp = Number1
: : : : : : Number1 = Number2
: : : : : : Number2 = temp
: : : : : : End If[/code]
: : : : : :
: : : : : : Jonathan
: : : : : :
: : : : : : ###
: : : : : : for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: : : : : : (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: : : : : : /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
: : : : : :
: : : : :
: : : : : thanks but after doing the above it has come up with this line
: : : : : sum = Number1 / Number2
: : : : : as having and error wot could it be
: : : : : from
: : : : : mark
: : : : :
: : : : It's due to the position of the planet Mars. You may also find your program won't work on some Thursday afternoons.
: : : :
: : : : Uh...I mean...post the error message, or we really have no clue.
: : : :
: : : : Jonathan
: : : :
: : : : ###
: : : : for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: : : : (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: : : : /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
: : : :
: : : :
: : : i get a few on is run time error '11' division by zero
: : Ah, OK. That's because your numbers could be zero. Try something more like:-
: : Number1 = 1 + Int(Rnd * 20)
: : Number2 = 1 + Int(Rnd * 20)
: : Instead so it can never be zero.
: :
: : : then another one is run time error '6' overflow
: : Overflow? Hmmmm....I can't think how you'd manage that, given you only have integers between 1 and 20! What values are going in when you get the overflow error (e.g. what are Number1 and Number2)?
: :
: : : and thats about it really and also how do i make it so after i type
: : : the answer in the text box and click enter how do i make it so i
: : : cannot type in the text box until the next question cums up
: : :
: : TextBox.Enabled = False ' To stop people typing in it
: : TextBox.Enabled = True ' To allow people to type in it again
: :
: : Jonathan
: :
: : ###
: : for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: : (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: : /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
: yo well the over flow thing does not seem to happen any more thanks and the no zero thing cums up any more thatnks for that mate
: but now the text box thing aint working though cos it still lets me type in it after i have hit eneter for the correct answer to be displayed
: from
: mark
:
: and by the eway here is where it has to be typed in yea
Dim Ans As Integer
''Only allow numbers, minus sign, decimal point, return key
If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = vbkeyMinus Or KeyAscii = vbKeyDecPt Or KeyAscii = vbKeyBack Then
Exit Sub
ElseIf KeyAscii = vbKeyReturn Then
If Ans = sum Then
NumRight = NumRight + 1
lblMessage.Caption = "That's The Correct Answer!"
Else
lblMessage.Caption = "Your Answer Is Wrong The Correct Anser Is " + Format(sum, "#0")
End If
lblScore.Caption = Format(1000 * NumRight / NumProb, "##0")
cmdNext.Enabled = True
cmdNext.SetFocus
txtAnswer.Enabled = False ' To stop people typing in it
txtAnswer.Enabled = True ' To allow people to type in it again
Else
KeyAscii = 0
End If
End Sub
and i have changed it from textbox to txtAnswer (my right name for the textbox so wot could be happening
from
mark
• : : : : : : : : Number1 = Int(Rnd * 20)
: : : : : : : : Number2 = Int(Rnd * 20)
: : : : : : : :
: : : : : : : : do while number2 > number1
: : : : : : : : Number2 = Int(Rnd * 20)
: : : : : : : : loop
: : : : : : : :
: : : : : : : Maybe it'd be more efficient to just swap them over if they're not as we want...
: : : : : : :
: : : : : : : [code]If Number2 > Number1 Then
: : : : : : : Dim temp as Long
: : : : : : : temp = Number1
: : : : : : : Number1 = Number2
: : : : : : : Number2 = temp
: : : : : : : End If[/code]
: : : : : : :
: : : : : : : Jonathan
: : : : : : :
: : : : : : : ###
: : : : : : : for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: : : : : : : (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: : : : : : : /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
: : : : : : :
: : : : : :
: : : : : : thanks but after doing the above it has come up with this line
: : : : : : sum = Number1 / Number2
: : : : : : as having and error wot could it be
: : : : : : from
: : : : : : mark
: : : : : :
: : : : : It's due to the position of the planet Mars. You may also find your program won't work on some Thursday afternoons.
: : : : :
: : : : : Uh...I mean...post the error message, or we really have no clue.
: : : : :
: : : : : Jonathan
: : : : :
: : : : : ###
: : : : : for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: : : : : (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: : : : : /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
: : : : :
: : : : :
: : : : i get a few on is run time error '11' division by zero
: : : Ah, OK. That's because your numbers could be zero. Try something more like:-
: : : Number1 = 1 + Int(Rnd * 20)
: : : Number2 = 1 + Int(Rnd * 20)
: : : Instead so it can never be zero.
: : :
: : : : then another one is run time error '6' overflow
: : : Overflow? Hmmmm....I can't think how you'd manage that, given you only have integers between 1 and 20! What values are going in when you get the overflow error (e.g. what are Number1 and Number2)?
: : :
: : : : and thats about it really and also how do i make it so after i type
: : : : the answer in the text box and click enter how do i make it so i
: : : : cannot type in the text box until the next question cums up
: : : :
: : : TextBox.Enabled = False ' To stop people typing in it
: : : TextBox.Enabled = True ' To allow people to type in it again
: : :
: : : Jonathan
: : :
: : : ###
: : : for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: : : (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: : : /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
: : yo well the over flow thing does not seem to happen any more thanks and the no zero thing cums up any more thatnks for that mate
: : but now the text box thing aint working though cos it still lets me type in it after i have hit eneter for the correct answer to be displayed
: : from
: : mark
: :
: : and by the eway here is where it has to be typed in yea
: Private Sub txtAnswer_KeyPress(KeyAscii As Integer)
: Dim Ans As Integer
: ''Only allow numbers, minus sign, decimal point, return key
: If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = vbkeyMinus Or KeyAscii = vbKeyDecPt Or KeyAscii = vbKeyBack Then
: Exit Sub
: ElseIf KeyAscii = vbKeyReturn Then
: If Ans = sum Then
: NumRight = NumRight + 1
: lblMessage.Caption = "That's The Correct Answer!"
: Else
: lblMessage.Caption = "Your Answer Is Wrong The Correct Anser Is " + Format(sum, "#0")
: End If
: lblScore.Caption = Format(1000 * NumRight / NumProb, "##0")
: cmdNext.Enabled = True
: cmdNext.SetFocus
: txtAnswer.Enabled = False ' To stop people typing in it
: txtAnswer.Enabled = True ' To allow people to type in it again
: Else
: KeyAscii = 0
: End If
: End Sub
: and i have changed it from textbox to txtAnswer (my right name for the textbox so wot could be happening
:
You have to put the code in the right place! You need to put the first line where you want the text box to be disabled, and the second one where you want it to be re-enabled.

: txtAnswer.Enabled = False ' To stop people typing in it
Put this one at the start of the sub.

: txtAnswer.Enabled = True ' To allow people to type in it again
Put this one at the end of the sub.

Jonathan

###
for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
(tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
/(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");

• : : : : : : : : : Number1 = Int(Rnd * 20)
: : : : : : : : : Number2 = Int(Rnd * 20)
: : : : : : : : :
: : : : : : : : : do while number2 > number1
: : : : : : : : : Number2 = Int(Rnd * 20)
: : : : : : : : : loop
: : : : : : : : :
: : : : : : : : Maybe it'd be more efficient to just swap them over if they're not as we want...
: : : : : : : :
: : : : : : : : [code]If Number2 > Number1 Then
: : : : : : : : Dim temp as Long
: : : : : : : : temp = Number1
: : : : : : : : Number1 = Number2
: : : : : : : : Number2 = temp
: : : : : : : : End If[/code]
: : : : : : : :
: : : : : : : : Jonathan
: : : : : : : :
: : : : : : : : ###
: : : : : : : : for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: : : : : : : : (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: : : : : : : : /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
: : : : : : : :
: : : : : : :
: : : : : : : thanks but after doing the above it has come up with this line
: : : : : : : sum = Number1 / Number2
: : : : : : : as having and error wot could it be
: : : : : : : from
: : : : : : : mark
: : : : : : :
: : : : : : It's due to the position of the planet Mars. You may also find your program won't work on some Thursday afternoons.
: : : : : :
: : : : : : Uh...I mean...post the error message, or we really have no clue.
: : : : : :
: : : : : : Jonathan
: : : : : :
: : : : : : ###
: : : : : : for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: : : : : : (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: : : : : : /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
: : : : : :
: : : : : :
: : : : : i get a few on is run time error '11' division by zero
: : : : Ah, OK. That's because your numbers could be zero. Try something more like:-
: : : : Number1 = 1 + Int(Rnd * 20)
: : : : Number2 = 1 + Int(Rnd * 20)
: : : : Instead so it can never be zero.
: : : :
: : : : : then another one is run time error '6' overflow
: : : : Overflow? Hmmmm....I can't think how you'd manage that, given you only have integers between 1 and 20! What values are going in when you get the overflow error (e.g. what are Number1 and Number2)?
: : : :
: : : : : and thats about it really and also how do i make it so after i type
: : : : : the answer in the text box and click enter how do i make it so i
: : : : : cannot type in the text box until the next question cums up
: : : : :
: : : : TextBox.Enabled = False ' To stop people typing in it
: : : : TextBox.Enabled = True ' To allow people to type in it again
: : : :
: : : : Jonathan
: : : :
: : : : ###
: : : : for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: : : : (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: : : : /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
: : : yo well the over flow thing does not seem to happen any more thanks and the no zero thing cums up any more thatnks for that mate
: : : but now the text box thing aint working though cos it still lets me type in it after i have hit eneter for the correct answer to be displayed
: : : from
: : : mark
: : :
: : : and by the eway here is where it has to be typed in yea
: : Private Sub txtAnswer_KeyPress(KeyAscii As Integer)
: : Dim Ans As Integer
: : ''Only allow numbers, minus sign, decimal point, return key
: : If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = vbkeyMinus Or KeyAscii = vbKeyDecPt Or KeyAscii = vbKeyBack Then
: : Exit Sub
: : ElseIf KeyAscii = vbKeyReturn Then
: : If Ans = sum Then
: : NumRight = NumRight + 1
: : lblMessage.Caption = "That's The Correct Answer!"
: : Else
: : lblMessage.Caption = "Your Answer Is Wrong The Correct Anser Is " + Format(sum, "#0")
: : End If
: : lblScore.Caption = Format(1000 * NumRight / NumProb, "##0")
: : cmdNext.Enabled = True
: : cmdNext.SetFocus
: : txtAnswer.Enabled = False ' To stop people typing in it
: : txtAnswer.Enabled = True ' To allow people to type in it again
: : Else
: : KeyAscii = 0
: : End If
: : End Sub
: : and i have changed it from textbox to txtAnswer (my right name for the textbox so wot could be happening
: :
: You have to put the code in the right place! You need to put the first line where you want the text box to be disabled, and the second one where you want it to be re-enabled.
:
: : txtAnswer.Enabled = False ' To stop people typing in it
: Put this one at the start of the sub.
:
: : txtAnswer.Enabled = True ' To allow people to type in it again
: Put this one at the end of the sub.
:
: Jonathan
:
: ###
: for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
: (tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
: /(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");
:

hi would u be able to put it in the oabove code for me in the correct place plz thanks you have been a great help
from
mark

• : : : Private Sub txtAnswer_KeyPress(KeyAscii As Integer)
: : : Dim Ans As Integer

: : : ''Only allow numbers, minus sign, decimal point, return key
: : : If (KeyAscii >= vbKey0 And KeyAscii <= vbKey9) Or KeyAscii = vbkeyMinus Or KeyAscii = vbKeyDecPt Or KeyAscii = vbKeyBack Then
: : : Exit Sub
: : : ElseIf KeyAscii = vbKeyReturn Then
: : : Ans = Val(txtAnswer.Text)
: : : If Ans = sum Then
: : : NumRight = NumRight + 1
: : : lblMessage.Caption = "That's The Correct Answer!"
: : : Else
: : : lblMessage.Caption = "Your Answer Is Wrong The Correct Anser Is " + Format(sum, "#0")
: : : End If
: : : lblScore.Caption = Format(1000 * NumRight / NumProb, "##0")
: : : cmdNext.Enabled = True
: : : cmdNext.SetFocus
: : : Else
: : : KeyAscii = 0
: : : End If

: : : End Sub
: hi would u be able to put it in the oabove code for me in the correct place plz thanks you have been a great help
:
There you go.

Jonathan

###
for(74,117,115,116){\$::a.=chr};((\$_.='qwertyui')&&
(tr/yuiqwert/her anot/))for(\$::b);for(\$::c){\$_.=\$^X;
/(p.{2}l)/;\$_=\$1}\$::b=~/(..)\$/;print("\$::a\$::b \$::c hack\$1.");

• I'm just gonna make the part about getting two numbers a little simpler here:

The formula for a random number is:

Int((Upper - Lower + 1) * Rnd + Lower)

So the first number should be:

'Max: 20
'Min: 2
Number1 = Int((20 - 2 + 1) * Rnd + 2)

The "lower" is 2 because you want the second number smaller, not a decimal and not zero so if the first number is as low as it can be (2), then that only leaves 1 for the other.

The second number is:

'Number1 - 1 is the max for Number2
'Min: 1
Number2 = Int((Number1 - 1 - 1 + 1) * Rnd + 1)

Clean those up a bit and we get:

Number1 = Int(19 * Rnd + 2)
Number2 = Int((Number1 - 1) * Rnd + 1)

Now Number1 will be in range and large enough for Number2 to be smaller and Number2 will be smaller than Number1 and not 0.

Hope this helps,
KDL

P.S. Someone let me know if I misremember the formula because I don't have VB on this computer...

: Hi everyone i need sum urgent help quick plz
: how do i make the number for lblNum2 to always be smaller then lblNum1 so the answer is never a decimal
: Private Sub cmdNext_Click()
: Dim Number1 As Integer
: Dim Number2 As Integer
: lblMessage.Caption = ""
: NumProb = NumProb + 1
: 'Generate random number for addends
: Number1 = Int(Rnd * 20)
: Number2 = Int(Rnd * 20)
: lblNum1.Caption = Format(Number1, "#0")
: lblNum2.Caption = Format(Number2, "#0")
: 'Find sum
: sum = Number1 / Number2
: cmdNext.Enabled = False
: End Sub
:
: mark
:
:

• Hi i have added the code for the text box to stop working after u have answered the question. but after i have answered it when i push enter to see if my answer is correct nothing happens the question is not checked what could the problem be
from
mark