Solved

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

Posted on 2008-06-16
4
223 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PowerShell: ForEach-Object Export to CSV 4 91
asp.net repeater server posting 5 37
Open telerik datetime picker programmatically 13 42
What!!!??? 5 60
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

732 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