0

Hello,

is this how a constructor is created and initialized. I am getting an error; VB does not like the "New"

what I am trying to do is to create a constructor with one argument and initialize its attribute.

Public Sub New(ByVal newProdNumber As Long)
        intProdNumber = newProdNumber
    End Sub

thanks

3
Contributors
4
Replies
12
Views
4 Years
Discussion Span
Last Post by chuchaykaw
0

If this is for a custom class, VB is probably suggesting that you also have a default New constructor:

Public Sub New()
    intProdNumber = 0
End Sub

It's ok to have both.

Also remember your constructors should initialize every member of your class

Edited by tinstaafl

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.