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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:25:27+00:00 2026-06-08T05:25:27+00:00

I defined a class in Form1 as public class Conditions { public string name

  • 0

I defined a class in Form1 as

    public class Conditions
    {
        public string name { get; set; }
        public int probability { get; set; }
        public DateTime start_time { get; set; }
        public DateTime end_time { get; set; }
        public int age_min { get; set; }
        public int age_max { get; set; }
        public bool meldpeld { get; set; }
        public bool onea { get; set; }
        public bool oneb { get; set; }
        public int gender { get; set; }  // 0 - both, 1 - male, 2 - female
        public int meld_min { get; set; }
        public int meld_max { get; set; }

    }

and I’m making a new list like

    List<Conditions> newconditions = new List<Conditions>();

Then, I’m calling Form2 with

        Conditions newconds = new Conditions();
        Form2 form2 = new Form2(newconds);
        form2.Show();
        form2.TopMost = true;

In Form2, I have

    public Form2(Form1.Conditions newcond)
    {
        InitializeComponent();
        comboBox1.SelectedIndex = 2;
    }

and I can use set things for newcond in there

what I would like to do, however, is set things in another function in Form2 called

    private void button2_Click(object sender, EventArgs e)

and I can’t figure out how to use the newcond in that function. I must be missing something obvious, right?

Also, is this a good way to go? Basically what I want to do is have the user define any number of conditions (that they can add, edit, delete) and then use those conditions when they run the program.

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-08T05:25:30+00:00Added an answer on June 8, 2026 at 5:25 am

    You’re on the right track sort of.

    Basically, I would move your Conditions class into it’s own file called Conditions.cs – this is best practice.

    Then define a member variable in your class file for Form2. Then in your Constructor for Form2 set that member variable.

    private Conditions _conditions;
    public Form2(Conditions cond)
    {
        _conditions = cond;
        InitializeComponent();
        comboBox1.SelectedIndex = 2;
    }
    

    then you can use that in your click method:

    protected void button2_click(object sender, EventArgs args)
    {
        //Do things with _conditions
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My SomeModel is defined as: public class SomeModel { public string property1 { get;
I have a class defined as: class Obj { public: int width, height; Obj(int
I have a user defined class, say import java.util.Calendar; public class Employee{ private String
I defined next class with virtual properties: public class Order: BaseEPharmObject { public Order()
I have a class defined as public class viewGroups extends ListActivity Somewhere in the
I've create the following class in Visual Studio 2010: public class Bat : Form1
I have a class defined as below: ref class myClass { PictureBox^ pic2; public:
I have a custom ViewModel defined as : public class SampleFormViewModel { public SampleFormViewModel(SelectList
Edit: new files. I'm having troubles accessing a public function in the Form1 class.
While you create a user defined class in Java, you do not specify it

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.