Hi ..
Can anyone please help me ?
Ik would like to raise a messagebox after the close-icon is clicked, asking
me if I'm sure to quit ...
I'm using this code ...
Private Sub myFormClosed(By Val sender As Object, ByVal e As
System.Windows. Forms.FormClose dEventArgs) Handles Me.FormClosed
Dim intResult = MessageBox.Show ("Are you sure to quit?", "Quit",
MessageBoxButto ns.YesNo, MessageBoxIcon. Question,
MessageBoxDefau ltButton.Button 1)
Select Case intResult
Case intResult.Yes
frmNext.Show() 'this form handles the quit
Me.Show()
End Select
End Sub
If i click on "no", the form hides itself, but the application is still
running ... bummer....
john 3 2607
Sorry, i forgot some line of code ...
I'm using this code ...
Private Sub myFormClosed(By Val sender As Object, ByVal e As
System.Windows. Forms.FormClose dEventArgs) Handles Me.FormClosed
Dim intResult = MessageBox.Show ("Are you sure to quit?", "Quit",
MessageBoxButto ns.YesNo, MessageBoxIcon. Question,
MessageBoxDefau ltButton.Button 1)
Select Case intResult
Case intResult.Yes
frmNext.Show() 'this form handles the quit
Case inResult.No
Me.Show()
End Select
End Sub
If i click on "no", the form hides itself, but the application is still
running ... bummer....
john
you need to use "Handles Me.FormClosing" instead of "Handles
Me.FormClosed"
John Devlon ha escrito:
Sorry, i forgot some line of code ...
I'm using this code ...
Private Sub myFormClosed(By Val sender As Object, ByVal e As
System.Windows. Forms.FormClose dEventArgs) Handles Me.FormClosed
Dim intResult = MessageBox.Show ("Are you sure to quit?", "Quit",
MessageBoxButto ns.YesNo, MessageBoxIcon. Question,
MessageBoxDefau ltButton.Button 1)
Select Case intResult
Case intResult.Yes
frmNext.Show() 'this form handles the quit
Case inResult.No
Me.Show()
End Select
End Sub
If i click on "no", the form hides itself, but the application is still
running ... bummer....
john
Hi John,
You need to write this code on 'Closing' event of the form instead of
writing on 'Closed' event. Here in 'closing' event you can cancel the
closing of the form just by using code of one line.
e.Cancel = True
This will cancel the closing event of the form.
Your code will look like this:
Private Sub myFormClosing(B yVal sender As Object, ByVal e As
System.Windows. Forms.FormClose dEventArgs) Handles Me.Closing
Dim intResult = MessageBox.Show ("Are you sure to quit?", "Quit",
MessageBoxButto ns.YesNo, MessageBoxIcon. Question,
MessageBoxDefau ltButton.Button 1)
if intResult = intResult.No then
e.Cancel = true 'Stops Closing of the Form
end if
End Sub
Regards,
Pragati Palewar
Palewar Techno Solutions
Windows Mobile & Palm Software Development
Nagpur, India http://www.palewar.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Lauren Quantrell |
last post by:
Running Access2000 ADP Project/MSDE on Windows XP...
- I Open my Access ADP project.
In the Windows Task Manager Processes window MSACCESS.EXE shows
up.
- I don't do anything else in Access.
- I click a toolbar button that executes the code: application.quit in
a module in my Acesss project.
- My Access project closes.
Now there are TWO instances of MSACCESS.EXE showing up in the
Windows Task Manager Processes window, my cursor is...
|
by: Eric |
last post by:
How can I quit a smartdevice application ?
After I click the right-hand(up) "X" button in the Pocket
PC 2002 Emulator,it seems that the smartdevice
application has not been closed.
(My smartdevice app has three forms.
Every form has a "X" button which is close to
the time information.)
Why? what happened when I click the button?
|
by: Max |
last post by:
I have the following code on a form that launches Microsoft Outlook and creates a new email message for the user:
Outlook.Application oApp = new Outlook.Application();
Outlook.MailItem oMail = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
oMail.HTMLBody = "SOME HTML TEXT HERE";
oMail.Display(oApp);
oMail.Close(Outlook.OlInspectorClose.olDiscard);
|
by: rdemyan via AccessMonster.com |
last post by:
Sometimes users (including myself) accidentally click on the application
close icon in the application menu bar when they meant to just click on the
'X' for the form. Of course the app closes and this is very annoying.
So, I added a messagebox to my hidden StartAppForm in the Unload event. Now
when the application closes the user is presented with a message so they can
abort closing in case they don't really want to close. This has been...
|
by: mdmdmd |
last post by:
Hello,
I wish to collect 4 files from a user. So I have decided to use
tkFileDialog askopenfilename. My problem is that after a few file
selections the root window is destroyed (the whole program just dissappears)
I have created a simple example and was able to reproduce the same thing
with this. I've just started using tkinter so I have no idea what I may
be doing wrong. If anyone has any ideas please let me know.
| |
by: somtabu |
last post by:
hello, i have a problem in vb.net windows application,
verson is 2005 and framework is 2.0
I want to close a form by using the close button which is right hand top side of the window. i want, when i click the close button a dialog box appear and ask me "Are you sure you want to Quit?" and there is 2 button (Yes and No).... if i click "Yes" button then the form is closed and if i click the "No" button then dialog box should be close.....
...
|
by: SoNew |
last post by:
I have designed a database and have used the following code to disable the standard Microsoft close button. I want my users to have to click on a Quit button on the switchboard:
Private Sub Form_Unload(Cancel As Integer)
Dim LResponse As Integer
LResponse = MsgBox("Please Use Quit Button on Main Menu", vbOKOnly)
If LResponse = vbOK Then
Cancel = True
End If
|
by: SoNew |
last post by:
I have designed a database and have used the following code to disable the standard Microsoft close button. I want my users to have to click on a Quit button on the switchboard:
Private Sub Form_Unload(Cancel As Integer)
Dim LResponse As Integer
LResponse = MsgBox("Please Use Quit Button on Main Menu", vbOKOnly)
If LResponse = vbOK Then
Cancel = True
End If
|
by: loneranger |
last post by:
Hi Everyone
Visual Studio 2005
VB 2005
Windows Application
I have a form with one combo box and a button
I want the user to make a selection from the combo box, click the button and have the application run an Access 2003 Macro, the database is embedded in my project.
I receive the following message when the button is clicked:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |