本文整理汇总了VB.NET中System.Web.UI.WebControls.ListItemCollection.Remove方法的典型用法代码示例。如果您正苦于以下问题:VB.NET ListItemCollection.Remove方法的具体用法?VB.NET ListItemCollection.Remove怎么用?VB.NET ListItemCollection.Remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。
在下文中一共展示了ListItemCollection.Remove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的VB.NET代码示例。
示例1: ListItem
Dim myListItem As ListItem = new ListItem(Delete.Text.ToLower(),Delete.Text.ToLower())
' Check whether the 'ListItem' is present in the 'ListBox' or not.
If(ItemCollection.Contains(myListItem)) Then
Dim deleteString As String =Delete.Text
' Delete the listitem entered by the user in textfield.
ItemCollection.Remove(deleteString.ToLower())
Message.Text="<font color='green'><b>Deleted Successfully</b></font>"
Else
Message.Text="<font color='red'><b>No ListItem with the given name is present in the ListBox for deletion.</b></font>"
End If
示例2:
' Add the selected item to DropDownList1.
DropDownList1.Items.Add(ListBox1.SelectedItem)
' Delete the selected item from ListBox1.
ListBox1.Items.Remove(ListBox1.SelectedItem)