Solved

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

Posted on 2008-06-16
4
222 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 500 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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project

679 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