473,322 Members | 1,620 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

exit command

i created an exitstrip tool on my system and i want my system to ask the user
if he/she really wants to exit the application. but when i add a command on
the forms close button my exitstrip tool doesn't work well. this is my
command on my exitstrip tool:

Private Sub ExitToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles ExitToolStripMenuItem1.Click
Flag = True
If MessageBox.Show("Do you really want to exit this application?", "",
MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
Me.Close()
Else
TextBox3.Focus()
End If
End Sub

and this is my command on my close button:

Private Sub Form3_FormClosing(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
If MessageBox.Show("Do you really want to exit this application?", "",
MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.No Then
e.Cancel = True
End If
End Sub

is there something wrong on my codes?

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...b-net/200803/1

Mar 18 '08 #1
1 2754
On Mar 18, 3:35 am, "enrico via DotNetMonster.com" <u41845@uwewrote:
i created an exitstrip tool on my system and i want my system to ask the user
if he/she really wants to exit the application. but when i add a command on
the forms close button my exitstrip tool doesn't work well. this is my
command on my exitstrip tool:

Private Sub ExitToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles ExitToolStripMenuItem1.Click
Flag = True
If MessageBox.Show("Do you really want to exit this application?", "",
MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
Me.Close()
Else
TextBox3.Focus()
End If
End Sub

and this is my command on my close button:

Private Sub Form3_FormClosing(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
If MessageBox.Show("Do you really want to exit this application?", "",
MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.No Then
e.Cancel = True
End If
End Sub

is there something wrong on my codes?

--
Message posted via DotNetMonster.comhttp://www.dotnetmonster.com/Uwe/Forums.aspx/dotnet-vb-net/200803/1
Your code works fine without "Flag = True" code line. What's your
problem by calling "doesn't work" ?
Mar 18 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Mike Maxwell | last post by:
<vent> I see there has been traffic over the years on this gripe, so just let me vent my frustration, and add another reason why 'exit' (or possibly exit() or quit() or halt() or some such) should...
11
by: Peter Steele | last post by:
I have a Windows application written in C# that I want to return a non-zero exit code when it it run. The problem is that as a Windows application, there doesn't seem to be a way to control this....
3
by: Micus | last post by:
Greetings, I need to execute 2 applications from an application or batch file. The first app launched has the user enter a product key and the app's exit code will be 0 (failed) or 1...
2
by: GGerard | last post by:
Hello Is there a way to exit all running procedures with one command? Sometimes a procedure(1) will call another procedure(2) which could call a third procedure(3) and what I would like to...
19
by: ern | last post by:
Right now I'm using exit(0) to terminate my program. My program is a console .exe application. After the "exit(0)" line of code is encountered, the console application waits for an enter press,...
7
by: Benzi Eilon | last post by:
I am executing an Expand command in order to expand a CAB file. This is done by calling CreateProcess with the Expand command and then WaitForSingleObject and checking the process exit code. My C++...
5
by: junw2000 | last post by:
My program is about several thousands lines. It takes arguements from the command line. If no arguement is given, it should simply exist. Below is the architectureof main() : int main(int argc,...
13
by: MZaza | last post by:
What command can I use to make the program quite after a certain condition? -- Mustafa Zaza
2
by: dstork | last post by:
Anyone know how to rename the "Exit Access" command at the bottom of the Office menu. I'd like to rename it to "Exit" as I had done in previous versions of Access. I know I can disable it with ...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.