locked
Overload resolution failed because no accessible 'New' is most specific for these arguments: RRS feed

  • Question

  • User476099922 posted

    Hi,

    I'm tring to write constructors for winWindow control and getting the above error message. please find my code below.

    Public Class WindowControls
        Enum PropertyTypes
            PropertyType_ClassName
            PropertyType_ControlId
            PropertyType_ControlName
            PropertyType_Name
        End Enum

        Public Class WinWindow
            Inherits MSWinControls.WinWindow

            Public Sub New()
                Me.New(Nothing)
            End Sub

            Public Sub New(ByVal parent As UITestControl)
                MyBase.New(parent)
            End Sub

            Public Sub New(ByVal propertyValue As String, Optional ByVal propertyType As PropertyTypes = PropertyTypes.PropertyType_Name, Optional ByVal conditionOperator As PropertyExpressionOperator = PropertyExpressionOperator.EqualTo)
                Dim getVals As GetEnumValues
                getVals = New GetEnumValues

                SearchProperties.Add(getVals.GetPropertyTypeValue(propertyType), propertyValue, conditionOperator)   'Implemented the method Add(String, String)
            End Sub

        End Class

        Protected Class GetEnumValues
            Public Function GetPropertyTypeValue(ByVal val As Integer) As String
                Select Case val
                    Case 0
                        GetPropertyTypeValue = "ClassName"
                    Case 1
                        GetPropertyTypeValue = "ControlId"
                    Case 2
                        GetPropertyTypeValue = "ControlName"
                    Case 3
                        GetPropertyTypeValue = "Name"
                    Case Else
                        GetPropertyTypeValue = ""
                End Select
            End Function
        End Class

    End Class

    I got the error at bold charachters at first overloaded Public Sub New() as

    Oveload resolution failed because no accessible 'New" is most specific for these arguments:

    'Public Sub New(propertyValue as Stirng, [propertyType as PropertyTypes = PropertyTypes.PropertyType_Name], [conditionOperator As Microsoft.VisulaStudio.TestTools.UITesting.PropertyExpressionOperator = PropertyExpressionOperator.EqualTo])': Not most specific.

    'Public Sub New(parent As Microsoft.VisualStudio.TestTools.UITesting.UITestControl)': Not most specific.

    help me how to mange both the oveload construtor.

    thanks,

    Ramaraju

    Monday, February 20, 2012 3:15 AM

Answers

  • User1109032460 posted

    Which of the other to constructors would you like it to call?

    You can either try casting Nothing to UITestControl if you want to use the UITestControl constructor, or you could choose to pass String.Empty if you wanted to go to the second.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 20, 2012 5:33 AM

All replies

  • User1109032460 posted

    Which of the other to constructors would you like it to call?

    You can either try casting Nothing to UITestControl if you want to use the UITestControl constructor, or you could choose to pass String.Empty if you wanted to go to the second.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 20, 2012 5:33 AM
  • User476099922 posted

    thanks for your inputs, my issues resolved

    Monday, February 27, 2012 6:10 AM