Solved

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

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

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
What can cause the styling on a .NET site to not be found? 17 26
Cant save 3D 4 21
Store results in vb.net 3 22
Help with exporting to excel 4 28
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

803 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