VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



This code creates a dancing ball and when the ball is lost it raises a pop up to ask if you want to

by Rajarathnam.L (3 Submissions)
Category: Graphics
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 19th April 2004
Date Added: Mon 8th February 2021
Rating: (1 Votes)

This code creates a dancing ball and when the ball is lost it raises a pop up to ask if you want to contine again.

Rate This code creates a dancing ball and when the ball is lost it raises a pop up to ask if you want to



Dim j As Integer
Dim k As Integer
Dim choice As Long

Private Sub Command1_Click()

 choice = MsgBox("    Do You Want Some Music Along With This Dance  ?   ", vbYesNo, "Confirm")
 If choice = vbYes Then
         MsgBox "         Sorry! Music Failed        ", vbOK, "Error"
 Else
    MsgBox "        Thank You        ", vbOK, "Happy"
 End If
 

Circle (550, 550), 500, RGB(0, 0, 0)
'First
For i = 50 To 10000 Step 5
Circle (i + 50, i + 200), 500, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Circle (i + 50, i + 200), 500, RGB(0, 0, 0)
Next

 For k = 1 To 2

'Second
j = 10200
For i = 10000 To 14500 Step 5
Circle (i + 50, j - 200), 500, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Circle (i + 50, j - 200), 500, RGB(0, 0, 0)
j = j - 5
Next

'Third
j = 5500
For i = 14500 To 12500 Step -2
Circle (i - 50, j - 200), 500, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Circle (i - 50, j - 200), 500, RGB(0, 0, 0)
j = j - 5
Next

'Fourth
j = 1
For i = 12500 To 10500 Step -1
Circle (i - 50, j + 200), 500, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Circle (i - 50, j + 200), 500, RGB(0, 0, 0)
j = j + 5
Next

'Fifth
j = 10000
For i = 10500 To 1000 Step -5
Circle (i - 50, j + 200), 500, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Circle (i - 50, j + 200), 500, RGB(0, 0, 0)
j = j - 5
Next

'Sixth
For i = 50 To 10000 Step 5
Circle (i + 50, i + 200), 500, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Circle (i + 50, i + 200), 500, RGB(0, 0, 0)
Next


'Seventh
j = 10200
For i = 10000 To 14500 Step 5
Circle (i + 50, j - 200), 500, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Circle (i + 50, j - 200), 500, RGB(0, 0, 0)
j = j - 5
Next


'Eighth
j = 5500
For i = 14500 To 3000 Step -5
Circle (i - 50, j - 200), 500, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Circle (i - 50, j - 200), 500, RGB(0, 0, 0)
j = j - 2
Next

'Nineth

For i = 3000 To 800 Step -5
Circle (i - 50, j - 200), 500, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Circle (i - 50, j - 200), 500, RGB(0, 0, 0)
Next

'Tenth
For i = 750 To 10000 Step 5
Circle (i + 50, i + 200), 500, RGB(Rnd * 255, Rnd * 255, Rnd * 255)
Circle (i + 50, i + 200), 500, RGB(0, 0, 0)
Next

Next
MsgBox "Ball Lost . Press OK Button To Get The Ball Back  ", vbOK, "Search"

Circle (550, 550), 500, RGB(Rnd * 255, Rnd * 255, Rnd * 255)

choice = MsgBox("   Shall  I  Continue  Dancing  ?  ", vbYesNo, "Dance")
If choice = vbYes Then
 Command1.SetFocus
 MsgBox "   Press ENTER key   ", vbOK, "Dance"
Else
  Command2.SetFocus
MsgBox "   Press ENTER key   ", vbOK, "End"
End If


End Sub





Private Sub Command2_Click()
MsgBox "    Quitting . . .     ", vbOK, "Quit"

End

End Sub



Download this snippet    Add to My Saved Code

This code creates a dancing ball and when the ball is lost it raises a pop up to ask if you want to Comments

No comments have been posted about This code creates a dancing ball and when the ball is lost it raises a pop up to ask if you want to. Why not be the first to post a comment about This code creates a dancing ball and when the ball is lost it raises a pop up to ask if you want to.

Post your comment

Subject:
Message:
0/1000 characters