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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T15:35:42+00:00 2026-06-03T15:35:42+00:00

I have a very complicated windows application which has 8 forms. There are Previous

  • 0

I have a very complicated windows application which has 8 forms. There are “Previous” and “Next” buttons on each form to back and forth for easily editing forms.

 private void ShowNext()
    {
        if (FormNext == null)
            FormNext = new SomeForm(this);
        FormNext.Show();
        this.Hide();
    }

    private void ShowPrev()
    {
        FormPrev.Show();
        this.Hide();
    }

    private void btnNext_Click(object sender, EventArgs e)
    {
        ShowNext();
    }

    private void btnBack_Click(object sender, EventArgs e)
    {
        ShowPrev();
    }

Each form will execute different sql insert table command. But the question is that I don’t want to finish all insertion on each form.

What I want to is to finish all in the last form once the user confirms the correct input values.
That means I have to pass all variables from the very beginning to the last one.

Question: can the memory hold all variables? How to pass them cross forms?

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-06-03T15:35:43+00:00Added an answer on June 3, 2026 at 3:35 pm

    Define a static public field in your main form, and update the value in each sub forms. Finally select the field in your last form for insertion

    Something on the following lines:

    public partial class Form1 : Form //your main fomr
        {
            public static List<MyContainerClass> myContainer= new List<MyContainerClass>();
            .............
    

    Here MyContainerClass could be some class defined in your code, which can hold all the values you want to persist. If its just a string, then you may create a list of string. Then in each form set value

    Form1.myContainer.Add(new_values);
    

    In the last form you can access the values

    foreach(MyContainerClass mc in Form1.myContainer)
    {
    //Do your work
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Windows Forms, .net 2.0 My main application thread has a form (A). I have
I have an application which has a loop, part of a Scheduler, which runs
I am facing very complicated issue with Activity Group. In my application I have
I have a very complicated problem that occurs only for non-admin windows user. I
I have a very complicated class(it has unordered_map and so on on inside it)
I have put together a very complicated search form. Using arrays I have managed
I have a horribly complicated (and very poorly designed) autodialer application I need to
I have a very complicated form and I choose to not use ModelForm since
Im having a very strange problem, i have a complicated view that returns incorrect
I have very simple window where I have 2 buttons - one for cancel,

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.