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

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

If this solved your problem please remember to mark this solved. Thanks.

Public Class class1  
    Shared x As Integer

    Shared Sub New()
          x=0  
    End Sub
End Class