 |
| View previous topic :: View next topic |
| Author |
Message |
winterHK Newbie
Joined: 30 Sep 2005 Posts: 1
|
Posted: Sep 30th, 2005 09:21 AM Post subject: How to make "Jumping button"? |
|
|
Jumping button
Use the Rnd statement to change the position of a button every time it is pressed
Syntax:
value = Int(Rnd()*upperbound)
Rnd statement generates a single precision random value between 0.0 up to (but not including) 1.0
For example:
DiceRoll = Int(Rnd()*6) + 1 will generate one of the six integer number 0,1,2,3,4,5
Position of the button is controlled by two properties
Top, Left
Use the proper naming convention for the button
Example of setting top and left properties:
btnName.Top = 100
btnName.Left = 200
----------------------------------------
I am a new user of VB, please help me. |
|
| Back to top |
|
Under--Score Regular

Joined: 19 Jul 2005 Posts: 88 Location: Location Location
|
Posted: Oct 21st, 2005 02:37 PM Post subject: |
|
|
Ok, Just make one Command button this time (Edit names etc where applicable) and use a standard size form. ie. dont change the size from when VB starts.
Private Sub Form_Load()
Command1.Caption = "Click Here For Adult Pics"
End Sub
Private Sub Command1_Click()
Randomize
IntLower = 100
IntUpper = 3240
IntLeftRandom = Int((IntUpper - IntLower + 1) * Rnd + IntLower)
Randomize
IntLower = 100
IntUpper = 2400
IntTopRandom = Int((IntUpper - IntLower + 1) * Rnd + IntLower)
Command1.Left = IntLeftRandom
Command1.Top = IntTopRandom
End Sub |
|
| Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|