?
Solved

simple message saying that user is not valid and then exit winapp.

Posted on 2008-06-16
4
Medium Priority
?
227 Views
Last Modified: 2013-12-17
private void Form1_Load(object sender, EventArgs e)
        {
            sbPnlMsg.Text = "";
            string sPath = "LDAP://peach/dc=wpg,dc=cwb,dc=ca";
            string fullname = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
            string[] parts = fullname.Split('\\');
            string sDomain = parts[0];
            string sUser = parts[1];
            string sGroup = "gl ca corporate data";
            InitialPrices.localhost.InitialPriceReportingService WS = new InitialPrices.localhost.InitialPriceReportingService();
            if ((sUser == "gtgifford") || (sUser == "mxcupryk") || (sUser == "gxgervais")) { }
            else
            {
                bool IsUserValid = WS.CheckUserAgainstGroupMembers(sPath, sDomain, sGroup, sUser);
                if (!IsUserValid) ============>         MsgBox.Show () exist;  not sure what to do here.
            }
            LoadInitialPriceReporting();
            BuildStatBar();
           
            HideTabs();
           
        }
0
Comment
Question by:mathieu_cupryk
  • 2
4 Comments
 
LVL 30

Accepted Solution

by:
anarki_jimbel earned 1500 total points
ID: 21798208


You may use     Application.Exit() method. Be aware that if you want to rise some events you might call Me.Close (Form.Close) method before exiting application.

See http://msdn.microsoft.com/en-us/library/system.windows.forms.application.exit(VS.71).aspx 
for more details.
0
 

Author Comment

by:mathieu_cupryk
ID: 21799472
can u please give a better explaination.
0
 
LVL 10

Expert Comment

by:margajet24
ID: 21799583
Application.Exit() // closes the application

what anarki_jimbel is trying to say is, if you need to do something before you close the application,
you can use Form.Close because maybe you are also handling FormClosing and FormClosed Events.. so that it would be fired before quitting..
0
 
LVL 30

Expert Comment

by:anarki_jimbel
ID: 21799981
Thank you margajet24. That's exactly what I meant.
BTW, it's described in the article I referenced above.

Really, if you use windows forms, you might not need to call Application.Exit().  If you current form is the main form - just call this.Close(), it would be enough.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question