如何删除 ListView 中的一行。我需要选择要删除的行,如果要删除该行,命令按钮将删除它并显示警告消息。其代码是什么?
最佳答案
假设您已经创建了 ListView (ListView1) 和按钮的 Click 事件(我们称它为 button1),通过双击它,可能会像这样:
所以代码应该是这样的:
private sub Button1_Click()
if ListView1.SelectedItem is nothing then exit sub
if MsgBox("Do you really want to delete?", "Question", vbYesNo) = vbYes then
ListView1.ListItems.Remove ListView1.SelectedItem.Index
end if
end sub
关于listview - 如何使用按钮从 VB6 ListView 中删除行(项目)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1815072/