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

  • Home
  • SEARCH
  • 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 6588503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:03:23+00:00 2026-05-25T17:03:23+00:00

I know this is a simple concept, but I need some help. I’m creating

  • 0

I know this is a simple concept, but I need some help. I’m creating a winforms app, in c#, and I’m trying to organize my code. The first screen is a log in, and once the user is authenticated I return the users details. How/where should I store these details so that I don’t have to retrieve them again each time I want to use them?

Thank you!

  • 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-25T17:03:23+00:00Added an answer on May 25, 2026 at 5:03 pm

    Along the lines of what the others have said about the global static class, but with some sample code :

    public class UserInfo
    {
        private int userID;
    
        public int UserID
        {
            get { return userID; }
        }
    
        private string userName;
    
        public string UserName
        {
            get { return userName; }
        }
    
        public UserInfo(int userID, string userName)
        {
            this.userID = userID;
            this.userName = userName;
        }
    }
    
    public static class GlobalInfo
    {
        private static UserInfo currentUser;
    
        public static UserInfo CurrentUser
        {
            get { return currentUser; }
            set { currentUser = value; }
        }
    }
    

    So, after the user has logged in, save the logged in info :

    GlobalInfo.CurrentUser = new UserInfo(123, "Bob Jones");
    

    When you need to fetch info :

    UserInfo userInfo = GlobalInfo.CurrentUser;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone write some sample code to explain this concept? I know what a
I know this should be simple and I should know it but it's eluding
I know this is a simple question for someone out there, but I have
I know this is a simple question, but I can't figure it out. Consider
I know this probably really simple but Im not sure what im doing wrong...
Alright, I know this is a simple question, but I can't seem to get
Please forgive my programming knowledge. I know this is a simple thing, but I
I know this sounds extremely newbieish, but even after going through some of the
UPDATED: Added some sample code to help clarify. Hi, Feel like this shouldn't be
I know this is simple, I just can't recall the best way to do

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.