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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:16:27+00:00 2026-06-02T08:16:27+00:00

I have Form1.cs which has two buttons say ADD and EDIT. Clicking ADD shows

  • 0

I have Form1.cs which has two buttons say “ADD” and “EDIT”.

Clicking “ADD” shows dialog Form2.cs.

Form2 has a TextBox and a ComboBox. Say we enter value “A” in textbox and select “A” from ComboBox.
Then close Form2.

Then when EDIT button is clicked on Form1, Form2 should show up with “A” in textbox and “A” selected in ComboBox.

This is a simple explanation. The real form I am using has around 10-12 different controls including combobox, checkbox, textbox etc.

My main doubt is where and how do we save these control values.

Is there a specific approach to this type of DialogBoxes that I am missing?

  • 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-02T08:16:30+00:00Added an answer on June 2, 2026 at 8:16 am

    Create class, that would store values that you want to pass (let’s call it Foo).

    Form2 should then have a property. In the setter of the property, set controls:

    public partial class Form2 : Form
    {
        private Foo _bar;
        public Foo Bar
        {
            set
            {
                _bar = value;
                //set your controls here
            }
        }
    

    On Edit button, set property like this:

    Form2 form2 = new Form2();
    form2.Bar = bar; //bar contains values to edit
    

    Then put a Save button on Form2, that would save values back from controls to this object.

    For every control I would have a field in Foo class, eg. string for textboxes, bool for checkboxes and enum or int for comboboxes (where integer value would equal selected index).
    Alternatively, you could use Dictionary class instead and have key and value pair for every control.

    You can also have some enum, if your form looks or behaves differently in New and Edit mode.

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

Sidebar

Related Questions

Background I have a Windows Form with the following items: ComboBox TextBox Two Buttons
Hello I have a form which has two buttons. In the form validation (onsubmit
I have page in which I edit some entity. That page has two command
I have two submit buttons in a form which has different values, one to
I have a form which has a few text boxes, and two submit buttons.
I have a form in Axapta/Dynamics Ax (EmplTable) which has two data sources (EmplTable
I have WPF Form which has many buttons with the same code. Appearance of
I have a windows application which has three forms : Form1,2,3. --Form 1, has
I have two forms. The first form Main has 2 buttons and a link
I currently have a windows form application composed of a textbox and two buttons

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.