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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T21:48:44+00:00 2026-06-09T21:48:44+00:00

I am making a simple wizard. I created one static class for holding my

  • 0

I am making a simple wizard. I created one static class for holding my forms:

    namespace LABEL_AUTOMATION
    {
        static class ProjectHelper
        {
            public static Form1 frm1 = new Form1();
            public static Form2 frm2 = new Form2();
        }

    }

and for form1’s next button I am having the following code:

 private void buttonNext_Click(object sender, EventArgs e)
    {
        this.Visible = false;
        ProjectHelper.frm2.Visible = true;
    }

and similar logic for form2’s back button:

private void buttonPrevious_Click(object sender, EventArgs e)
{
    this.Visible = false;
    ProjectHelper.frm1.Visible = true;
}

The problem is that when I move between the forms, the values of the controls like textbox gets cleared.

How to correct it ?

Also, I am using the form’s visible changed event to execute the code when the user switches between forms. But, the event gets fired before the form gets visible. Any other event that I can use ?

EDIT: I actually didnt change the Program.cs file which was actually creating and running a seperate instance of Form1. So I changed my code to:

static void Main()
{
    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    ProjectHelper.frm1.Show();
}  

But it is giving the following error:

The type initializer for 'LABEL_AUTOMATION.ProjectHelper' threw an exception.
  • 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-06-09T21:48:46+00:00Added an answer on June 9, 2026 at 9:48 pm

    I think you are showing/hiding instances of your forms which are not in ProjectHelper class.

    You should at Main do

    ProjectHelper.frm1.Show();
    

    or

    ProjectHelper.frm2.Show();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making simple connection between two table - first one called users has
I am making simple one on server side & one on client side application
I'm making simple php chat, and i need to refresh messages in one div.I
I´m making a simple website to display information from XML file that is created
I have a simple web application in which I have created a wizard, each
making a simple movie review site to practice PHP. on one page ( a
I'm making a simple program that copies files created or modified since it was
I am making simple grid like game ( grid is matrix 128x128) and matrix
Making a simple application, so when the user logs out of Windows, it of
Im making a simple alternative to the default linux system monitor. Im looking to

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.