分部方法必须声明为“Private”,而非“<accessModifier>”

在分部方法声明中需要具有访问修饰符 Private 。 下面的示例演示如何在方法签名及其实现中使用 Private

' Definition of the partial method signature.  
Partial Private Sub OnNameChanged()  
    ' The body of the signature is empty.  
End Sub  
' Implementation of the partial method.  
Private Sub OnNameChanged()  
    MsgBox("Name was changed to " & Me.Name)  
End Sub  

错误 ID: BC31431

更正此错误

  • 在签名和实现声明中,将访问修饰符更改为 Private

另请参阅