Hi...does anyone know to pass a controls collection to a constructor?
It is only supposed to have 1 argument.
There are 5 methods ont he form (4 are the lst box collections and 1 is the
total of all. I'm guessing that is the one to send, but am unsure how to do)
It also wants this MyBase.New statement????
Any thoughts are greatly appreciated.
Please post the relevant section of code directly as many people, myself included, are unlikely to want to download entire projects unnecessarily.
Having said that, a constructor is just a method. If you want to pass parameters to a constructor then you have to declare an argument list, just like any other method, e.g.
VB Code:
Public Sub New(ByVal controls As ControlCollection)
When you invoke the instructor, which you do with the "New" key word, you pass the parameter value just like you do any other method, e.g.
VB Code:
Dim f2 As New Form2(Me.Controls)
I'm quite sure that you've passed parameter values to other constructors before.
As for MyBase.New, MyBase always refers to the base class of the current instance. By calling MyBase.New in your constructor you are calling the base class's constructor first, which does all the standard work of constructing the object before you add code to perform the custom work specific to your class.