Udostępnij za pośrednictwem


Method '<methodname1>' must be declared 'Private' in order to implement partial method '<methodname2>'

The implementation of a partial method must be declared Private. For example, the following code causes this error.

Partial Class Product

    ' Declaration of the partial method.
    Partial Private Sub valueChanged()
    End Sub

End Class
Partial Class Product

    ' Implementation of the partial method, with Private missing, 
    ' causes this error. 
    'Sub valueChanged()
    '    MsgBox(Value was changed to " & Me.Quantity)
    'End Sub

End Class

Error ID: BC31441

To correct this error

  • Use the access modifier Private in the implementation of the partial method, as shown in the following example.

    Private Sub valueChanged()
        MsgBox(Value was changed to " & Me.Quantity)
    End Sub
    

See Also

Concepts

Partial Methods

Access Levels in Visual Basic