1

I am creating a WinForms application (for an instrumentation system) where the main form displays a list of equipment in a tableLayoutPanel wrapped in a groupBox. Each item has an associated label and comboBox. The application must populate the list of equipment at runtime, and then the user will select a value for each comboBox, which the application will fetch to run tests.

Here is a partial screenshot of what I'm describing:

Test Equipment screenshot

I would like to make a class to hold the list of items, the possible options for the associated comboBox, and the user's selection and then data bind it such that changes to the class cause the correct controls to be created and populated. But I'm not sure if this is possible, and if it is, how I'd set up the binding sources?

Per this example, this is the class I think I should start with:

public class TestEquipment
{
    public string Name { get; set; }
    public List<string> Options { get; set; }
    public string Selection { get; set; }

    public TestEquipment(string name, string selection)
    {
        Name = name;
        Selection = selection;
    }
}
adamj537
  • 677
  • 7
  • 14
  • Create a class having some properties (not fields) and use for data-binding. Also instead of `ArrayList` use a `List`. – Reza Aghaei Jan 14 '19 at 17:04
  • Anyway, the question is too broad and opinion based. – Reza Aghaei Jan 14 '19 at 17:28
  • Is it opinion-based because there are multiple implementations that would satisfy my requirements? If so, it would be nice to have a comparison between the options. – adamj537 Jan 14 '19 at 17:33
  • Probably [codereview.stackexchange.com](https://codereview.stackexchange.com) is a better place for asking such question. Take a look at [on-topic](https://codereview.stackexchange.com/help/on-topic) and [off-topic](https://codereview.stackexchange.com/help/dont-ask) questions there. – Reza Aghaei Jan 14 '19 at 17:37
  • 3
    Per the guidelines from off-topic questions: "Code Review is for open-ended questions about code that already works correctly (to the best of your knowledge). Questions seeking help about debugging or understanding code are off-topic for Code Review, and may be on-topic for Stack Overflow." – adamj537 Jan 24 '19 at 17:41

0 Answers0