Page 1 of 1

Help

Posted: Sat Sep 24, 2005 11:53 am
by Patrickssj6
How do i make it that when i press on a button in one Textbox is will give me a random number from 1-10.This is in VB6

Posted: Sun Sep 25, 2005 9:07 am
by modder4321

Code: Select all

private sub command1_click()
text1.text = int(rnd * 10)
end sub

Posted: Sun Sep 25, 2005 9:17 am
by Patrickssj6
Yes i found it already on google.Tnx anyway.BUt i have another problem:
I want to make that if TextBox1 equals TextBox2 there will be a MessageBox.BUt som,ehow it doesn't work.
This is what i did:

Code: Select all

If TextBox1.Equals(TextBox2 Then
MessageBox.Show("You have done it")
Else
MessageBox.SHow("Try again")

Posted: Sun Sep 25, 2005 9:31 am
by modder4321
Patrickssj6 wrote:Yes i found it already on google.Tnx anyway.BUt i have another problem:
I want to make that if TextBox1 equals TextBox2 there will be a MessageBox.BUt som,ehow it doesn't work.
This is what i did:

Code: Select all

If TextBox1.Equals(TextBox2 Then
MessageBox.Show("You have done it")
Else
MessageBox.SHow("Try again")
wat are u coding in?

Posted: Sun Sep 25, 2005 9:51 am
by Patrickssj6
VB6

Posted: Sun Sep 25, 2005 10:01 am
by modder4321
where the fuck u get that code it would be

Code: Select all

private sub command2_click()
if text1.text = text2.text then
msgbox("yea its equal")
else
msgbox("not equal =<")
endif

Posted: Sun Sep 25, 2005 10:11 am
by Patrickssj6
well that code doesn't work for me.I have the express edition if this helps.But i try to change it to my version gimme a sec

Posted: Sun Sep 25, 2005 2:01 pm
by modder4321
Patrickssj6 wrote:well that code doesn't work for me.I have the express edition if this helps.But i try to change it to my version gimme a sec
make 2 text boxes and 2 command buttons in code section have this

Code: Select all

private sub command1_click()
text1.text and text2.text = int(rnd * 10)
end sub

private sub command2_click() 
if text1.text = text2.text then 
msgbox("yea its equal") 
else 
msgbox("not equal =<") 
endif
end sub