Solved

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

Posted on 2008-06-16
4
218 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 29

Accepted Solution

by:
anarki_jimbel earned 500 total points
Comment Utility


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
Comment Utility
can u please give a better explaination.
0
 
LVL 10

Expert Comment

by:margajet24
Comment Utility
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 29

Expert Comment

by:anarki_jimbel
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now