方法“<methodname1>”必须声明为“Private”才能实现分部方法“<methodname2>”

分部方法的实现必须声明为 Private。 例如,下面的代码会导致此错误。

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: BC31441

更正此错误

  1. 在分部方法的实现中使用访问修饰符 Private ,如以下示例中所示。
Private Sub valueChanged()  
    MsgBox("Value was changed to " & Me.Quantity)  
End Sub  

另请参阅