Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6847557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:45:34+00:00 2026-05-27T00:45:34+00:00

I need to make an application for school that includes a login and rights.

  • 0

I need to make an application for school that includes a login and rights. I am checking the login and am trying to store the userlevel in a class. I tried using a global variable, but somehow it doesn’t work.

EDIT: This problem is semi-solved. Opening the form isn’t. (Read the last part)

Class (userlevel):

private static int ulevel = 99;

public static int gCheckLevel
{
    get { return ulevel; }
    set { ulevel = value; }
}

When logged in this will happen:

userlevel.gCheckLevel = ulvl;
Main_MDI main = new Main_MDI();
main.mCommitRights();

Trying to open the right form after the login is succesful

Form start_screen_admin = new start_screen_admin();

public void mCommitRights()
{
    if (userlevel.gCheckLevel == 0)
    {
        // Admin, no changes
        MessageBox.Show("Admin");
        mForms(start_screen_admin);
    }
}

But the last part doesn’t work. What am I doing wrong here? I need to store the userlevel, because querying to the database every single time I need it is not necessary.

EDIT:

The last part doesn’t work 100%, the global works, but the mForms doesn’t, but it does anywhere else.

private void mForms(Form f)
{
    if (this.MdiChildren.Contains(f)) { f.WindowState = FormWindowState.Normal; }
    else { f.MdiParent = this; f.Show(); }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:45:34+00:00Added an answer on May 27, 2026 at 12:45 am

    Can you access the static property from an instance of the class like that? Why are they static? Can they not just be instance properties?

    MSDN says “A static method, field, property, or event is callable on a class even when no instance of the class has been created. If any instances of the class are created, they cannot be used to access the static member. Only one copy of static fields and events exists, and static methods and properties can only access static fields and static events. Static members are often used to represent data or calculations that do not change in response to object state; for instance, a math library might contain static methods for calculating sine and cosine”

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For a school project, I need to make a simple paint application that can
I need to make so that my application can have only one instance running
I'm trying to test an application and I need to make an valid IP
I need to make portable application, that will run on Windows, Linux, MacOS and
I am trying to make an Iphone application for mobile health using html5,javascript, jqtouch
I need to make an application that will start playing same media on two
I want to make an application that will need userLocation, but MkMapView.userLocation is just
I need to make application that will catch EVERY SINGLE SMS that phone receives,
I need to make some changes to a ClickOnce application that I haven't touched
I have 4 different email ids at gmail.I need to make an application that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.