Sending different types of data thru a Form's constructor

  • Thread starter Thread starter VMI
  • Start date Start date
V

VMI

My Winform's constructor currently takes one parm, which is an integer. But
I need for it to be able to take an integer or an array of integers. Is it
possible to "create" two constructor methods?

Thanks.
 
Yes. You can create as many constructors you want as long as they have
different parameters.

Shariq Khan
 
Yes. In every sense a form class is no different then any class you define.
It is because it derives from System.Windows.Forms.Form that "makes" it a
form class and allows the framework to expect certain interfaces and
behaviors. Other then that you can define constructors, statics,
public/private/internal methods and properties as normal. It is
instanciated with "new" like any other class, as it is a class. I think you
want to call ": this()" in your constructor line at the end so the empty
constructor is called which calls InitializeComponent();.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top