|
-
Apr 26th, 2013, 02:14 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] form close button
I want to preform a check before my form is closed.
how can I do this when a user hits Alt + F4 or clicks the close button on my form?
-
Apr 26th, 2013, 02:37 AM
#2
Re: form close button
When a form is about to close, it raises its FormClosing event. You can handle that event and perform whatever actions you need to perform. To prevent the form closing, just set e.Cancel to True. Just be careful that you don't prevent Windows exiting as a result. The e.CloseReason property can tell you why the form is closing.
-
Apr 26th, 2013, 09:38 AM
#3
New Member
Re: form close button
yes, i have tested your way, but i saw some problem, hic!!!
-
Apr 26th, 2013, 10:42 AM
#4
Re: form close button
 Originally Posted by skyman2610
yes, i have tested your way, but i saw some problem, hic!!!
Yes, the problem is on line 12.
-
Apr 26th, 2013, 12:20 PM
#5
Re: form close button
Are you sure? I was thinking it was line 8...
-tg
-
Apr 26th, 2013, 12:57 PM
#6
Re: form close button
 Originally Posted by techgnome
Are you sure? I was thinking it was line 8...
Well, there's a minor issue there as well but at least we both saw some problems with the code that was never posted.
-
Apr 26th, 2013, 09:17 PM
#7
Re: form close button
I dont get it, I'm only seeing 6 lines of code
-
Apr 26th, 2013, 09:18 PM
#8
Re: form close button
 Originally Posted by skyman2610
yes, i have tested your way, but i saw some problem, hic!!!
In case you missed it, JA and tg are suggesting that you should post your code because if have no idea what your code even looks like then the chances of our determining what the problem is and fixing it is pretty much nil.
-
Apr 26th, 2013, 10:30 PM
#9
Thread Starter
Hyperactive Member
Re: form close button
I had no code as I wasn't sure how to start, your reply was helpful. Others, well perhaps a more more social interaction with others is in need
-
Apr 26th, 2013, 10:33 PM
#10
Re: [RESOLVED] form close button
Uh-huh... ok...
"yes, i have tested your way, but i saw some problem, hic!!!" <--- this implied you had tried some code and it didn't work...
-tg
-
Apr 26th, 2013, 10:39 PM
#11
Re: form close button
 Originally Posted by ubkra
I had no code as I wasn't sure how to start, your reply was helpful. Others, well perhaps a more more social interaction with others is in need 
You said that you had tested and saw a problem but if you had no code then how could you have tested? It may not seem like a big deal to those who post a question now and again but those of us who answer lots of questions every day have to wade through a morass of poorly worded posts. Posts that ask for help with code that they do not provide are common and frustrating.
-
Apr 26th, 2013, 11:51 PM
#12
Thread Starter
Hyperactive Member
Re: [RESOLVED] form close button
 Originally Posted by ubkra
I want to preform a check before my form is closed.
how can I do this when a user hits Alt + F4 or clicks the close button on my form?
Sorry where did I say I had tested my code?
-
Apr 27th, 2013, 12:21 AM
#13
Re: [RESOLVED] form close button
 Originally Posted by ubkra
Sorry where did I say I had tested my code?
I just realised that post #3 was made under a different account. From the apparent manner of the post I assumed that it was made by the OP, i.e. you. Was that you logged in under a different account? If not then I apologise for my incorrect assumption.
-
Apr 27th, 2013, 12:24 AM
#14
Thread Starter
Hyperactive Member
Re: [RESOLVED] form close button
all good, thanks for your original help
-
Apr 27th, 2013, 12:25 AM
#15
Re: [RESOLVED] form close button
Sorry ubkra, technome and my own reply wasn't aimed towards you but to skyman2610 who said that he had some problems with it but never expanded on what the problem was and didn't post any code. I think jmcilhinney just mixed up your question with skyman2610's reply, that's one of the thing that can happen when somebody hijacks someone else's thread.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|