MenuItemCollection.Replace Method
Replaces the first instance of the first MenuItem parameter with the second MenuItem parameter.
Namespace: Microsoft.SharePoint.WebPartPages
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No
Syntax
'Declaration
Public Sub Replace ( _
oldMenuItem As MenuItem, _
newMenuItem As MenuItem _
)
'Usage
Dim instance As MenuItemCollection
Dim oldMenuItem As MenuItem
Dim newMenuItem As MenuItem
instance.Replace(oldMenuItem, newMenuItem)
public void Replace(
MenuItem oldMenuItem,
MenuItem newMenuItem
)
Parameters
oldMenuItem
Type: Microsoft.SharePoint.WebPartPages.MenuItemThe MenuItem object that you want to delete from the collection.
newMenuItem
Type: Microsoft.SharePoint.WebPartPages.MenuItemThe MenuItem object that you want to add to the collection.
Remarks
The Replace method will add the newMenuItem object to the end of the menu if the first oldMenuItem object does not exist.