So here I will give you the code to make a program that dose not let you close it, you press a button another thing comes up. YOU JUST CAN'T CLOSE IT 
First make 2 buttons and 1 label.
1. Name the label : Just try to close me!
2. Name button 1 "Close me"
3. Name button 2 "CLOSE!!!"
4. here is the code for button 1:
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim newform1 As New Form1
times = times + 1
newform1.Text = "Try to Close This!" & times.ToString
newform1.Show()
End Sub
5. Double click form 1 so you get your code.
Right beside From1 events there's a drop down menu, there make the from1 Click
and type this in:
Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
MsgBox(" Windows errors, you are tying to click here. YOU CAN'T CLICK HERE!", MsgBoxStyle.Critical, "ERROR")
MsgBox("Windows is trying to finalize.", MsgBoxStyle.Critical, "Windows Information")
Application.Exit()
End Sub
then double click form1 again and youll get a blank code spot again make that spot FormClosing
The code for that is:
Code:
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If e.CloseReason = CloseReason.UserClosing Then
e.Cancel = True
MsgBox("Try Another way bud...", MsgBoxStyle.Critical, "ERROR")
ElseIf e.CloseReason = CloseReason.ApplicationExitCall Then
e.Cancel = True
MsgBox("Application is trying to finalize itself but it is impossible", MsgBoxStyle.Critical, "ERROR")
ElseIf CloseReason.TaskManagerClosing Then
e.Cancel = True
MsgBox(" Task manager? ITS NOT FAIR!", MsgBoxStyle.Critical, "ERROR")
Application.DoEvents()
End If
End Sub
And for button 2 its
Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Application.Exit()
End Sub
Over all it should look like this:
Code:
Public Class Form1
Dim times As Long = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim newform1 As New Form1
times = times + 1
newform1.Text = "Try to Close This!" & times.ToString
newform1.Show()
End Sub
Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
MsgBox(" Windows errors, you are tying to click here. YOU CAN'T CLICK HERE!", MsgBoxStyle.Critical, "ERROR")
MsgBox("Windows is trying to finalize.", MsgBoxStyle.Critical, "Windows Information")
Application.Exit()
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If e.CloseReason = CloseReason.UserClosing Then
e.Cancel = True
MsgBox("Try Another way bud...", MsgBoxStyle.Critical, "ERROR")
ElseIf e.CloseReason = CloseReason.ApplicationExitCall Then
e.Cancel = True
MsgBox("Application is trying to finalize itself but it is impossible", MsgBoxStyle.Critical, "ERROR")
ElseIf CloseReason.TaskManagerClosing Then
e.Cancel = True
MsgBox(" Task manager? ITS NOT FAIR!", MsgBoxStyle.Critical, "ERROR")
Application.DoEvents()
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Application.Exit()
End Sub
End Class