且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

验证项目是否已存在

更新时间:2023-12-02 18:20:46

你可以使用Contains查看它是否已经存在



You can use Contains to see if it's already there

listView1.Items.Contains





http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.listviewitemcollection.contains.aspx [ ^ ]





http://www.c-sharpcorner.com/UploadFile/mgold/listviewduplicate05082007222909PM/listviewduplicate.aspx [ ^ ]


这是如何检查

如果ListViewEx1.Items.ToString.Contains(ss)= True那么

MsgBox(是)

否则

MsgBox(否)

结束如果
this is how to check
If ListViewEx1.Items.ToString.Contains("ss") = True Then
MsgBox("yes")
Else
MsgBox("no")
End If


if(listviewDATA.FindItemWithText(txtName.Text) != null)
{
   MessageBox.Show("Found!");
}
else
{
   MessageBox.Show("Data doesn't Exist");
}