Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

under which event do u make it so that when u click the X button it displays, "Are you sure u want to exit" (yes or no)

 

i tried form1.closing and form1.closed

but it doesnt work

which event do u need.

My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!)

vbprogramming.8k.com

My Project (Need VB.NET Programmers)

http://workspaces.gotdotnet.com/ResolutionRPG

  • Leaders
Posted

   Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
       If MsgBox("are you sure you want to quit", MsgBoxStyle.OKCancel, Application.ProductName) = MsgBoxResult.OK Then
           e.Cancel = False
       Else
           e.Cancel = True
       End If

 

that should sort you out :)

Posted

form.closing is used when you want to display the "are you sure you want to close prompt"

Private Sub frmT_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If MsgBox("Are you sure you want to close?", MsgBoxStyle.YesNo, "Close?") = MsgBoxResult.Yes Then
Application.exit
else   'don't exit app
       e.Cancel = True
       
end if
   End Sub

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...