We help IT Professionals succeed at work.
Get Started

VB.NET - Class and form working together

Wil999 asked
Last Modified: 2016-04-23

I have a class called ParameterSelection, and a form called frmParameterSelection with a bunch of controls which are needed for the user to make a selection.

What is the best way to let the class work with, and react to the control events on the form?
Should i declare an instance of the class in the form_load event? Or should i declare an instance of the form in the class? I want to have as little code as possible in the form.

When i declare an instance of the form in my class, i can only react on the form events. (not on the form controls events) I don't think it is very pretty to declare each form control (withevents) in the class and pass them in in the constructor.

Hopefully someone has a clear way to do this.

Watch Question
Senior Developer
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE