Share via


RemoveAt Method (Common)

Removes the item at the specified index.

public void RemoveAt(
   int index
)

Parameters

  • index
    The index number of the item to remove.

Example

The following example demonstrates how to use the RemoveAt method to remove an item from the ObjectListCommandCollection.

Sub ShowTaskDetail(sender As [Object], e As ObjectListSelectEventArgs)
   'Check conditions to Add or remove Commands in detailview
   If ObjectList1.Selection("Flag").Equals("No") Then
      
      ObjectList1.Commands.RemoveAt(1)
   
    End If
   If ObjectList1.Selection("Name").Equals("Name1") Then
      
      ObjectList1.Commands.RemoveAt(0)
   
    End If
End Sub 

[C#]

void ShowTaskDetail(Object sender, ObjectListSelectEventArgs e)
{
   //Check conditions to Add or remove Commands in detailview
   if(ObjectList1.Selection["Flag"].Equals("No"))
   {
      ObjectList1.Commands.RemoveAt(1);
   }
   if(ObjectList1.Selection["Name"].Equals("Name1"))
   {
      ObjectList1.Commands.RemoveAt(0);
   }
}

See Also

Applies to: DeviceSpecificChoiceCollection Class | MobileListItemCollection Class