Solved

VB.NET Close Window Event (Basic stuff here)

Posted on 2007-03-19
4
220 Views
Last Modified: 2012-05-05
I have a VB.NET app with many forms, for this example I will use Form1

When the user clicks the red X (top right) I want to fire an event that pops up a message asking the user if they want to save, if yes, then fire SubA, if no then fire SubB.

Thanks
0
Comment
Question by:Crazy_Penguins
  • 3
4 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 18752679
I believe you'll want to do this in the FormClosing event...

Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
  Dim strResp As String=MessageBox.Show("Do you want to save?","Save changes?", MessageBoxButtons.YesNo)
  If strResp=vbYes Then SubA
  SubB
End Sub
0
 
LVL 67

Assisted Solution

by:sirbounty
sirbounty earned 500 total points
ID: 18752681
http://www.codeproject.com/vb/net/appsettings2005.asp?df=100&forumid=234082&exp=0&select=1291168 details this with application settings upon closing the form...
0
 

Author Comment

by:Crazy_Penguins
ID: 18754068
sirbounty,

Thanks for the code example!

Andrew
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18755224
Happy to help - thanx for the grade!  :^)
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question