473,804 Members | 2,460 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exitting application and signing out

I know this sounds ridiculous but I am having problems when exiting/sighing
out of my application.

I have two forms, Login and Main. On Main form, I have two buttons, Sign
Out and Exit. These two buttons and the close button (X) should ask user to
confirm exiting or signing out, then if Yes, they should write log file and
then do:
- When I click exit, I should close both, main and login form.
- when I click Sign out, I should close only main and show login form.

That is simple, but the problem starts when I want my X (close button on
main form, upper right corner) to behave the same way as my Exit button.

Any help will be appreciated

--
Dino Buljubasic
Software Developer
http://rivusglobal.com
Nov 20 '05 #1
4 4186
"Dino M. Buljubasic" <di************ *@rivusglobal.c om> wrote in
news:%q******** *********@news1 .telusplanet.ne t:

That is simple, but the problem starts when I want my X (close button
on main form, upper right corner) to behave the same way as my Exit
button.

I think this should work. Basically you handle the Form.Closing event:

Public Sub test(ByVal sender As Object, ByVal e As
System.Componen tModel.CancelEv entArgs) Handles MyBase.Closing

'Execute a Sub
MsgBox("The Form is Closing!")

'You can stop Form.Close from closing by doing this
e.Cancel = True
End Sub

There's some stuff in the docs about not putting validation code in the
closing method... I haven't read through it carefully so I don't know
what problems this may cause.

http://msdn.microsoft.com/library/de...l=/library/en-
us/cpref/html/frlrfsystemwind owsformsformcla ssclosingtopic. asp

--
Lucas Tam (RE********@rog ers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 20 '05 #2
Cor
Hi Lucas,
Public Sub test(ByVal sender As Object, ByVal e As
System.Componen tModel.CancelEv entArgs) Handles MyBase.Closing

'Execute a Sub
MsgBox("The Form is Closing!")

'You can stop Form.Close from closing by doing this
e.Cancel = True
End Sub

Looks like the good old days, closing programs with ctrl alt del
:-)

(I know you can put an if before it in a real program).
Cor

Nov 20 '05 #3
Hello,

"Dino M. Buljubasic" <di************ *@rivusglobal.c om> schrieb:
- When I click exit, I should close both, main and
login form.
- when I click Sign out, I should close only main and
show login form.

That is simple, but the problem starts when I want my
X (close button on main form, upper right corner) to
behave the same way as my Exit button.


\\\
Private Sub Form1_Closing( _
ByVal sender As Object, _
ByVal e As System.Componen tModel.CancelEv entArgs _
) Handles MyBase.Closing
If ... Then
e.Cancel = True ' Cancel closing process.
End If
End Sub
///

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #4
Is there a way for me inside the form.closing event to detect which button
is calling the form.close?

That way, I could distinguish btw my Sign Out, Exit and X buttons

Thank you for your help

--
Dino Buljubasic
Software Developer
http://rivusglobal.com

"Herfried K. Wagner [MVP]" <hi*******@m.ac tivevb.de> wrote in message
news:Or******** ******@TK2MSFTN GP10.phx.gbl...
Hello,

"Dino M. Buljubasic" <di************ *@rivusglobal.c om> schrieb:
- When I click exit, I should close both, main and
login form.
- when I click Sign out, I should close only main and
show login form.

That is simple, but the problem starts when I want my
X (close button on main form, upper right corner) to
behave the same way as my Exit button.


\\\
Private Sub Form1_Closing( _
ByVal sender As Object, _
ByVal e As System.Componen tModel.CancelEv entArgs _
) Handles MyBase.Closing
If ... Then
e.Cancel = True ' Cancel closing process.
End If
End Sub
///

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet

Nov 20 '05 #5

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

Similar topics

1
3210
by: Martin | last post by:
I have a couple of questions around code signing with MS technology: 1. Is there a way to transfer the generated strong name signing private key directly to a smartcard (or generate it on the smart card), without the unsecure intermediate storage to the filesystem using sn -k and sn -i? 2. What is the format of the key files produced by sn -k and sn -p? 3. Is there a way to generate a PKCS#10 format certificate request from the sn -p...
43
2855
by: Davey | last post by:
I am planning on developing an application which will involve skills that I have very little experience of - therefore I would appreciate comments on my initial design thoughts. Overview on system: I'm not going to divulge the exact aims of the application but the purpose of it is to allow multiple client applications to retrieve data from a database (on a db server) and feed this data into another Windows
4
2744
by: Todd Richardson | last post by:
Two questions. We would like to have users complete ASP.NET web forms for submission. Once these are completed I would like to generate an XML document from the form. The XML document should include the data and the form so that the orginal document could be recreated even if the submitting form is changed in the future. I would also like to sign the XML document so that we can provide proof that the xml document has not been...
11
5137
by: Todd Matson | last post by:
I have several database applications developed in Access 2000. Some of my users have upgraded to Access 2003, and they get a warning every time they open the application: "This file may not be safe if it contains code that was intended to harm your computer." I understand that there are two ways to avoid this message. One is to set the security level on Access to low. The other is to sign the database with a digital certificate, and ask...
1
1679
by: AVL | last post by:
Hi I need some clarification on signing. what does it mean--signing an assembly? where is ti used? How is it used?
3
1197
by: =?Utf-8?B?SklNLkgu?= | last post by:
Signing PDF on the web application I have a web application that created PDF based on the information users give in the site, how can I get this PDF be signed electronically, is there any sample code I can use?
0
1161
by: Ken | last post by:
I have an application that uses SQL Server Express that I have published with VB 2005. Not long ago I purchased a new computer and loaded VB 2008. It would not let me publish my application with out a signing certificate. I have tried to uncheck the requirement of the signing certificate but when I attempt to publish I find it is checked again. I can create a test certificate but I want to be able to give my application away with out...
6
5686
by: raylopez99 | last post by:
Anybody use Strong Name Signing? I think this is used by default for Resource files, which is one reason perhaps I can't get my resource files to work (somehow the public key is messed up, perhaps since I've installed so many versions of Visual Studio) RL http://msdn.microsoft.com/en-us/library/h4fa028b.aspx Deployment in Visual Studio
1
8721
by: BillE | last post by:
<extreme frustration> I have googled and read about this, but can't seem to get a grip on it. Apparently I am being coerced into digitally signing applications. Is this true? What if I don't want to? The basic question is: If I click the "Create Test Certificate" button on the Signing tab of the properties for my application so I can publish it, what happens when I distribute the application?
0
9704
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, 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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9571
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10561
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10302
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 most users, this new feature is actually very convenient. If you want to control the update process,...
1
7608
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5505
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5639
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.