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 6631509
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T22:33:20+00:00 2026-05-25T22:33:20+00:00

The user clicks a button, a new form is generated where the user enters

  • 0

The user clicks a button, a new form is generated where the user enters his/her password? How can I keep an in-memory copy of the username?

For instance in web forms, I can just use Session (“User”). How can I replicate this with winforms?

Thanks

  • 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-25T22:33:21+00:00Added an answer on May 25, 2026 at 10:33 pm

    You could use a static (Shared in VB .NET) object

    Example

    Public Class SessionInformation
    
       Public Shared Property UserPassword As String
    
    End Class
    

    You can then access this by calling

    SessionInformation.UserPassword
    

    Since there seems to be some concerns revolving around whether or not this is a valid implementation I will explain why this is not the best idea.

    This creates a single instance of SessionInformation which means that if it is changed anywhere in the program it affects the rest of the program.

    Maintaining object persistence can be difficult if you aren’t using a database (SQL, Access, a file, etc…) to maintain an out of memory copy of the object that you want to retrieve at a later date. The easiest way to implement this would be to use a SQLCE database that live in your application folder and using standard T-SQL to store the information that you need. However in the case of a password this may be non-ideal due to security issues.

    Or the better way for logging in and out user would be to make use of the System.Security.Principal Namespace to create a user for your application.

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

Sidebar

Related Questions

How can I force validation when user clicks button? One would think this should
When the user clicks a button, I want his browser to automatically scroll to
When a user clicks a submit button I want the form to be submitted.
When the user clicks an Edit button on my form, I want a box
I am trying to create two form elements when the user clicks a button,
I'm working with the Passive View pattern. The user clicks a new account button.
I have several forms(user can add new form dynamically) in one page, they're all
In this scenario: User enters some information into a textbox User clicks a button
My goal: the user clicks a button. From the button pops up a two-level
In my typical app, the user clicks a button in an aspx page, invokes

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.