Partager via


La méthode '<NomMéthode1>' doit être déclarée 'Private' pour implémenter la méthode partielle '<NomMéthode2>'

Mise à jour : novembre 2007

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

L'implémentation d'une méthode partielle doit être déclarée Private. Par exemple, le code suivant génère cette erreur.

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

ID d'erreur : BC31441

Pour corriger cette erreur

  • Utilisez le modificateur d'accès Private dans l'implémentation de la méthode partielle, comme indiqué dans l'exemple suivant.

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

Voir aussi

Concepts

Méthodes partielles

Niveaux d'accès dans Visual Basic