473,378 Members | 1,578 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,378 software developers and data experts.

on closing event of the form

Hi all

I want to do in my application something like we have on ICQ. when you close
the application it doesn't close.

I've done like that

Private Sub Form1_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
e.Cancel = CancelFlag
If CancelFlag Then
Me.Hide()
End If
End Sub

and i've put in a exit button click that

cancelflag = False
iconn.Visible = False
Me.Close()

it works just fine... but when i try to close the windowsXP with the program
running it won't close.

what can i do?
who to know if the close event comes from window or from the user?
--
tks.

Daniel Sélen Secches
CWD Web Internet.
www.cwd.com.br
Nov 20 '05 #1
3 1287
* "Daniel Sélen Secches" <danielATcwdDOTcomDOTbr> scripsit:
I want to do in my application something like we have on ICQ. when you close
the application it doesn't close.

I've done like that

Private Sub Form1_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
e.Cancel = CancelFlag
If CancelFlag Then
Me.Hide()
End If
End Sub

and i've put in a exit button click that

cancelflag = False
iconn.Visible = False
Me.Close()

it works just fine... but when i try to close the windowsXP with the program
running it won't close.


You can detect when Windows wants to shutdown/... and allow closing:

<http://dotnet.mvps.org/dotnet/samples/windowsandforms/downloads/CloseWindow.zip>

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Website Address Changed!
Nov 20 '05 #2
i'll test it... tks... : >

do you have that file with english comments? :>

tks again..
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> escreveu na mensagem
news:c1*************@ID-208219.news.uni-berlin.de...
* "Daniel Sélen Secches" <danielATcwdDOTcomDOTbr> scripsit:
I want to do in my application something like we have on ICQ. when you close the application it doesn't close.

I've done like that

Private Sub Form1_Closing(ByVal sender As Object, ByVal e As
System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
e.Cancel = CancelFlag
If CancelFlag Then
Me.Hide()
End If
End Sub

and i've put in a exit button click that

cancelflag = False
iconn.Visible = False
Me.Close()

it works just fine... but when i try to close the windowsXP with the program running it won't close.
You can detect when Windows wants to shutdown/... and allow closing:

<http://dotnet.mvps.org/dotnet/sample...ds/CloseWindow
..zip>
--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Website Address Changed!

Nov 20 '05 #3
* "Daniel Sélen Secches" <danielATcwdDOTcomDOTbr> scripsit:
i'll test it... tks... : >

do you have that file with english comments? :>


I feel sorry, currently it's only available in German.

--
Herfried K. Wagner [MVP]
<http://dotnet.mvps.org/>
Website Address Changed!
Nov 20 '05 #4

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

Similar topics

1
by: Chris Bruce | last post by:
In my application I need a way to distiguish between the following events: 1. When a user closes an MDI child window. 2. When the user closes the MDI parent window which subsequently closes the...
1
by: **Developer** | last post by:
When I get a closing event in a MID Child form I don't know if the child form is closing or the main form is closing. Is there a way to tell? Thank
4
by: HANG LAM | last post by:
hi, How do I capture the closing events coming from the 'X' icon in the top-right corner of a form and the Form.Close() command? I want to be able to differentiate between the Closing Event...
10
by: Charles Law | last post by:
For some reason, when I click the X to close my MDI parent form, the action appears to be re-directed to one of the MDI child forms, and the parent remains open. I am then unable to close the...
3
by: Charles Law | last post by:
Under what circumstances would e.Cancel be set to True on entry to the Closing event of an MDI child form? I have found that this is why my application won't close properly. I can explicitly set...
3
by: Sumit | last post by:
HI.. I am having problem ot determine that a parent form is closing or not in my VB.Net code Any help Sumit
2
by: Tom | last post by:
How is the best way to avoid validation when closing a window? For instance, I have a Windows Forms window which has a validation event for a text box. However, if one enters invalid data in then...
4
by: Academic | last post by:
Does it make sense to put this If e.Cancel Then Exit Sub at the beginning of form closing events so if the user cancels the app's exiting in one Closing routine he will not be asked again by...
14
by: =?Utf-8?B?UHVjY2E=?= | last post by:
Hi, I'm using VS2005 and .net 2.0. I'm creating an application that has 3 forms. I want allow users to move forward and backward with the forms and retain the data users have entered. I thought...
19
by: zacks | last post by:
I have a .NET 2.0 MDI application where the child form has a Tab Control. Each of the Tab in the Tab Control has a Validating event to handle what it should do when the user changes tabs. But...
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.