Click here to Skip to main content
15,913,610 members
Please Sign up or sign in to vote.
3.33/5 (3 votes)
See more:
Hey, i have create two main Form AS FrmAdmin and frmuser and Want to Execute that FrmAdmin will open when System user Name is Administrator or frmUser name is open in any account except Administrator
but i am unable to create it because i have no any logic how to specify a Main Method to execute on a Condition.
Please Help Me.. :(( :((
Posted

1 solution

As i getting your Answer you have two Main Form and you want to execute your Main Form on the basis of System user Name.
You Can try this, it may Work

C#
if (SystemInformation.UserName.Equals("Administrator"))
            {
                Application.Run(new FrmAdmin());
            }
            else
             { 
          Application.Run(new frmUser());
             }
 
Share this answer
 
Comments
ShilpaKumari 23-Oct-10 8:55am    
Thanks it realy works

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900