473,398 Members | 2,393 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,398 software developers and data experts.

Close & Dispose

I´ve got a little program with the "x" in the upper right corner and a menu item "close" to do the same - end the program.

The problem now is that using my program it gets sometimes impossible to end the program. Clicking the "x" nothing happens and
calling
this.Close();
when the menu item "close" is pressed also doesn´t change anything.

But calling
this.Close();
this.Dispose();
when the user clicks the menu item, the program is shut down!

I´ve checked my program for any infinite loops but I didn´t find anything.
Does someone have an idea where to look else to resolve such kind of problem?

Any help is welcome.
Thanks and greetings,
Tim.
Nov 15 '05 #1
2 2116
Tim,

Do you have code that hooks up to the Closing event? Is it possible
that you are cancelling the closing in the event somehow (assuming you hook
up to it)?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Tim Bücker" <ti***********@web.de> wrote in message
news:br**********@news.uni-koblenz.de...
I´ve got a little program with the "x" in the upper right corner and a menu item "close" to do the same - end the program.
The problem now is that using my program it gets sometimes impossible to end the program. Clicking the "x" nothing happens and calling
this.Close();
when the menu item "close" is pressed also doesn´t change anything.

But calling
this.Close();
this.Dispose();
when the user clicks the menu item, the program is shut down!

I´ve checked my program for any infinite loops but I didn´t find anything.
Does someone have an idea where to look else to resolve such kind of problem?
Any help is welcome.
Thanks and greetings,
Tim.

Nov 15 '05 #2
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com>
Do you have code that hooks up to the Closing event? Is it possible
that you are cancelling the closing in the event somehow (assuming you hook
up to it)?
Thanks for answering!
I didn´t hook up the closing event but I´ve inserted some custom controls in
my form - one custom control consisting of TextBox, Label1 and Label2.

Removing them from the form and adding them later again I forget to dispose
these objects and due to that I couldn´t close my program (although I don´t
understand 100% why a program halts in this case as the garbage collector
should take care of this - probably too slow...)

Thanks again for answering!
Greetings,
Tim.
"Tim Bücker" <ti***********@web.de> wrote
I´ve got a little program with the "x" in the upper right corner and a
menu item "close" to do the same - end the program.

The problem now is that using my program it gets sometimes impossible to

end the program. Clicking the "x" nothing happens and
calling
this.Close();
when the menu item "close" is pressed also doesn´t change anything.

But calling
this.Close();
this.Dispose();
when the user clicks the menu item, the program is shut down!

I´ve checked my program for any infinite loops but I didn´t find anything.
Does someone have an idea where to look else to resolve such kind of

problem?

Any help is welcome.
Thanks and greetings,
Tim.

Nov 15 '05 #3

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

Similar topics

7
by: Willem van Rumpt | last post by:
Hi all, coming from an unmanaged programming background, I took my time to sort out the IDisposable and finalizer patterns. Just when I thought I had it all conceptually neatly arranged, the...
10
by: Jim H | last post by:
I sometimes get the following error from my Form's Dispose Method when the application is closing: ------------------------------------------------- An unhandled exception of type...
6
by: Ashish | last post by:
It might be basics for many but I never gave attention on this before. Steps: Add 2 forms (Form1/Form2) in application. Create a object in Form1 for Form2. Form2 f2 = new Form2(); //line...
6
by: Simon Harris | last post by:
Hi All, Do I need to use both Conn.Close() & Conn.Dispose() when I have finished with an SQL connection? -- I am using the free version of SPAMfighter for private users. It has removed...
35
by: Eric Sabine | last post by:
In my Finally block, I was using cn.close (where cn is an ADO.NET connection object, SQLConnection to be exact) and then I came across the following in some microsoft code. If Not cn Is Nothing...
8
by: Paul W | last post by:
Hi - in an asp.net application, how should I close out a sqlclient.connection? What combination and order of Conn.close conn.dispose conn=nothing Should I use? Specifically, is the...
3
by: Karan | last post by:
I am calling finalize when form2 loads and deactivates form1 which closes form1. However, same thing is not happening in form2 because finalize is already called. Does anybody has solution to it....
3
by: Joris De Groote | last post by:
Hi, I use Adobe Acrobat to read tekst from PDF files. After that the file has been read, I move the file in a folder (using the date I got from the text I got from Acrobat). Now here is my...
3
by: davis | last post by:
Hi, I'm wrapping a 3rd party .NET 2.0 CF library which mandates Dispose be called. So, I mandate Dispose be called on my library...I follow the Disposable pattern described on MSDN...and I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
marktang
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,...
0
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...
0
jinu1996
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...
0
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...
0
isladogs
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...

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.