Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » .NET General

Post new topic   Reply to topic
How to make "Jumping button"?
View previous topic :: View next topic  
Author Message
winterHK
Newbie


Joined: 30 Sep 2005
Posts: 1

PostPosted: Sep 30th, 2005 09:21 AM    Post subject: How to make "Jumping button"? Reply with quote

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
View user's profile Send private message
Under--Score
Regular


Joined: 19 Jul 2005
Posts: 88
Location: Location Location

PostPosted: Oct 21st, 2005 02:37 PM    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » .NET General All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
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


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic