1. Ji

    JizzaBeez The One and Only
    0/47

    Joined:
    Nov 15, 2009
    Messages:
    384
    Likes Received:
    136
    Trophy Points:
    0
    Gender:
    Male
    Location:
    Cerebral Cortex.
    Console:
    Xbox
    Here is an example of using a Loop. When loaded, the Form will Hide and the computer will Beep however many times (or for how long) that you specify. Then a MessageBox will pop up and ask if you want to Exit (if it's set to True).

    Here is the complete source. Just copy and paste all of it to a Form. If the Form you're using isn't named "Form1.vb" then either rename your Form or change the Form names in the code. You can also use the "BeepLoop" Class in anything you want, just call the sub from your Form.

    This can actually be a safe and funny prank to play on someone. And it will not harm anything at all.

    If you set it like :

    BeepLoop.DoLoop(50, 100, False)

    ...then it never stops beeping until you close the program from Task Manager (because the Form doesn't ever show and there's no other way to close it), LOL.

    Code:
    'Beep Loop
    '
    'Created by JizzaBeez
    
    
    Public Class Form1
    
    	Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     	'Hide the Form
     	Me.Hide()
     	'Do Loop
     	BeepLoop.DoLoop(50, 100, True)
    	End Sub
    
    End Class
    
    
    Class BeepLoop
    
    	Shared Sub DoLoop(Optional ByVal LoopCount As Integer = 50, Optional ByVal SleepCount As Integer = 100, Optional ByVal ShowMessage As Boolean = True)
     	Dim Loopz As Integer = 0
     	Do Until Loopz = LoopCount
     	Loopz += 1
     	Beep()
     	Threading.Thread.Sleep(SleepCount)
     	If Loopz = LoopCount Then
     	If ShowMessage = True Then
     	If MsgBox("Do you want to Exit?", MsgBoxStyle.YesNo, "Exit") = MsgBoxResult.Yes Then
     	MsgBox("Created By JizzaBeez", MsgBoxStyle.Information, "About")
     	Form1.Close()
     	Else
     	Loopz = 0
     	End If
     	Else
     	Loopz = 0
     	End If
     	End If
     	Loop
    	End Sub
    
    End Class
    
    I have attached the Project Source if anyone needs it. And also the app so you can get your friends to try it lol.
     

    Attached Files:

Share This Page

Close