troubleshooting Question

vb.net - compilation error when trying to call overloaded constructor

Avatar of LeighWardle
LeighWardleFlag for Australia asked on
Visual Basic.NETVisual C++.NET
6 Comments1 Solution317 ViewsLast Modified:
Hi Experts,

Here is a sample of my code.

Public Class clsLicenceSentinel

    Private mvarintProgramNumber As Integer

    Public Sub New(intProgramNumber As Integer)

        mvarintProgramNumber = intProgramNumber

    End Sub

    Public Sub New(strProgramNameAndMajorVersion As String)

        Dim intProgramNumber As Integer

        Select Case strProgramNameAndMajorVersion
            Case "APSDS3"
                intProgramNumber = 1
            Case "CIRCLY6"
                intProgramNumber = 2
            Case "CIRCLY3"
                intProgramNumber = 3
            Case "CIRCLY4"
                intProgramNumber = 4
            Case "APSDS4"
                intProgramNumber = 5
            Case "CIRCLY5"
                intProgramNumber = 6
            Case "APSDS5"
                intProgramNumber = 7
            Case "HIPAVE1", "HIPAVE5" '20050208
                intProgramNumber = 8

        End Select

        'call the constructor 
        Call New (intProgramNumber)  '<<<< gives "Type Expected" error

    End Sub

End Class

I am trying to call the overloaded constructor (see 3rd statement from the end).
But this gives a compiler "Type Expected" error.

Regards,
Leigh
ASKER CERTIFIED SOLUTION
Sethi

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros