Hallo,
I have a Mdi form in which I show a MessageBox if the user tries to
close it. If the user clicks YES, then the form closes; if it clicks
NO then it aborts.
I added the following lines in my form Closing event:
If MessageBox.Show ("Are you sure do you want to exit?", gsAppName,
MessageBoxButto ns.YesNo, MessageBoxIcon. Question,
MessageBoxDefau ltButton.Button 2) = Windows.Forms.D ialogResult.Yes Then
Me.Close()
End If
But it doesn't work. So I was wondering if someone is so kind to point
me to the error.
I'm using VB.NET
Thanks in advance.
PS My apologies for my bad english.
Best Regards,
David Desmet 4 3047
On Jun 11, 12:23 pm, iDesmet <idesmet.w...@g mail.comwrote:
Hallo,
I have a Mdi form in which I show a MessageBox if the user tries to
close it. If the user clicks YES, then the form closes; if it clicks
NO then it aborts.
I added the following lines in my form Closing event:
If MessageBox.Show ("Are you sure do you want to exit?", gsAppName,
MessageBoxButto ns.YesNo, MessageBoxIcon. Question,
MessageBoxDefau ltButton.Button 2) = Windows.Forms.D ialogResult.Yes Then
Me.Close()
End If
But it doesn't work. So I was wondering if someone is so kind to point
me to the error.
I'm using VB.NET
Thanks in advance.
PS My apologies for my bad english.
Best Regards,
David Desmet
David,
Try this one:
Private Sub Form1_Closing(B yVal sender As System.Object, ByVal e As
System.Componen tModel.CancelEv entArgs) Handles MyBase.Closing
If MessageBox.Show ("Are you sure do you want to exit?",
"gsAppName",Mes sageBoxButtons. YesNo,
MessageBoxIcon. Question,Messag eBoxDefaultButt on.Button2) =
Windows.Forms.D ialogResult.Yes Then
Application.Exi t()
Else
e.Cancel = True
End If
End Sub
Thanks,
Onur Güzel
"iDesmet" <id**********@g mail.comschrieb
Hallo,
I have a Mdi form in which I show a MessageBox if the user tries to
close it. If the user clicks YES, then the form closes; if it clicks
NO then it aborts.
I added the following lines in my form Closing event:
If MessageBox.Show ("Are you sure do you want to exit?", gsAppName,
MessageBoxButto ns.YesNo, MessageBoxIcon. Question,
MessageBoxDefau ltButton.Button 2) = Windows.Forms.D ialogResult.Yes
Then Me.Close()
End If
But it doesn't work. So I was wondering if someone is so kind to
point me to the error.
If MessageBox.Show ("Are you sure do you want to exit?", gsAppName, _
MessageBoxButto ns.YesNo, MessageBoxIcon. Question, _
MessageBoxDefau ltButton.Button 2) = Windows.Forms.D ialogResult.No
Then
e.cancel = True
End If
Note: DialogResult.Ye s changed to DialogResult.No .
You don't have to (or must not) call Me.Close because it must have been
called before already; otherwise the FormClosing event would not have been
fired.
Armin
David,
Just from my memory.
DirectCast(me.M DIParent,TheMai nForm).Close()
Would do the trick
(I am not so busy with all the kind of tricks in VBNet for VB6 users, so
maybe it can be done with less code)
Cor
"iDesmet" <id**********@g mail.comschreef in bericht
news:17******** *************** ***********@d45 g2000hsc.google groups.com...
Hallo,
I have a Mdi form in which I show a MessageBox if the user tries to
close it. If the user clicks YES, then the form closes; if it clicks
NO then it aborts.
I added the following lines in my form Closing event:
If MessageBox.Show ("Are you sure do you want to exit?", gsAppName,
MessageBoxButto ns.YesNo, MessageBoxIcon. Question,
MessageBoxDefau ltButton.Button 2) = Windows.Forms.D ialogResult.Yes Then
Me.Close()
End If
But it doesn't work. So I was wondering if someone is so kind to point
me to the error.
I'm using VB.NET
Thanks in advance.
PS My apologies for my bad english.
Best Regards,
David Desmet
Thank you all for the kind help and fast reply... this has helped me
very much.
I appreciate your time.
Thanks,
David Desmet This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: T.E. |
last post by:
Hi all,
I'm a newbie in php.
I encounter a problem with php form that has only one textfield.
If I click on the submit button, the form works fine. However, when I
press 'enter', the form doesn't work right.
After comparing that form with other forms, I noticed the problem
|
by: Robert V |
last post by:
Hi all, I could use some help programming on of my Perl script to handle
different submit buttons within the same form. Here is what I have so far.
A user goes to a Web form and inputs some data into a textarea box. Below
this box there are two buttons ... one that is labelled "Save & Exit" and
other that is labelled "Save and Preview" On...
|
by: btopenworld |
last post by:
I am submitting a form using an image as the link to a js file.
The image calls a js function which checks fields- issuing alerts for
errors - if no errors it then submits the form.
I would like to have a final confirm box run from the function before the
form is submitted.
I guess I would have to use the return statement somehow but I...
|
by: Laurent Bertin |
last post by:
Hi i got a strange problem but it's true i don't make thing like anyone...
First Config:
+ IIS5.0 SP2 (yes i know...)
WebSite Security
Root : Digest Authentication, NT Authenticated
SubFolders : Anonymous Login
Anonymous login is set to use a domain user to enable a sql server
authenticated connection. Permissions are based on...
|
by: Raed Sawalha |
last post by:
i have form i need when user Close the form a messagebox confirm him with
Yes or No if yes exist if no stay....how can i achieve this?
| |
by: Simon |
last post by:
I need to force a exit if a critical file is not found???
|
by: deko |
last post by:
I have a basic feedback form with a submit button.
After the "send" button is clicked, I want the user to be redirected to a
different page that says "Your message has been sent."
How do I do this?
I've tried using:
header("Location:http://www.mysite.com/send-confirm.php");
|
by: RLN |
last post by:
Re: Access 2003
I have a process that sends out emails to addresses (internally in our
company). Form1 has all the main functionality/data, etc on it. When
the user clicks "Send Emails" on Form1, I change my cursor to an
hourglass when it starts and change it back to normal when finished. I
would like to be able to show a 2nd form...
|
by: John Boyd |
last post by:
I know I can post to page 2 but the problem is I need to capture the name, email (optional), and referral source. If i post to page 2 then it simply asks for the required fields. If I do get it doesn't work at all. I'm sure there must be a relatively easy solution and I know my code has extra mess... I'm more of a coder than developer so please...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |