Need Help With Random Number Placement
I need to create a " Calculator" in VB and we cannot go into negative numbers for subtraction. So i need to have highest number first then lowest number 2nd. I have created a bit of code but it doesnt work to the best. I was wondering if you could help me and well, correct it for me.
Some of the ovious stuff is their right, just figured id insert the general code so you get idea of what ive done. Thx
Thx
Code:
Randomize
num1 = Int(Rnd * 10) + 1
num2 = Int(Rnd * 10) + 1
LblNum1 = num1
LblNum2 = num2
If LblNum1 > LblNum2 Then
LblNum1 = num1
LblNum2 = num2
Else
LblNum1 = num2
LblNum2 = num1
End If
Re: Need Help With Random Number Placement
Code:
Randomize
num1 = Int(Rnd * 10) + 1
num2 = Int(Rnd * 10) + 1
if num1 > num2 then
LblNum1 = num1
LblNum2 = num2
Else
LblNum1 = num2
LblNum2 = num1
End if
Re: Need Help With Random Number Placement
Thats great thank you, i know i had the general idea right, just didnt get it. Im doing a college IT course and we do some VB so i gotta design this as a project, not a pro or owt so yano =) Thx for help.
Re: Need Help With Random Number Placement
Now that we've helped you, you can help us by marking the thread as resolved. If you have JavaScript enabled you can do that easily by pulling down the Thread Tools menu and selecting the Mark Thread Resolved item. Also if someone has been particularly helpful you have the ability to affect their forum "reputation" by rating their post. Only those ratings that you give after you have 20 posts will actually count, but in all cases the person you rate will see it and know that you appreciate their help.
And BTW I don't know where in your program the randomize statement appears, but it should be someplace like Form_Load so that it is only done once.