帮助使用多个选定的列表视图项 [英] help using multiple selected listview items

查看:64
本文介绍了帮助使用多个选定的列表视图项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面有此代码,我们在其中获取所选listview项的代码,并将其从特定位置删除,然后显示一条消息,指出已将其删除.我的问题是我想选择多个项目并删除它们.有人可以帮我演示如何使用代码,然后显示在文本框中删除的所有名称.

现在有2个要删除的项目,一个是从文件中删除的,另一个是远程计算机上的文件夹.我用虚线将2和3分隔开,但最重要的是显示在弹出的diaplogbox中删除的内容.

我是编程新手,我一直在尝试使用循环,但是我似乎只得到了一项.任何帮助都会很棒.

i have this code below where we get the code for the selected listview item and delete it from a specific location and then display a message that it was deleted. The issue i have with it is that i want to select multiple items and delete them. can someone help show me how i would do that with the code and then display all the names that were deleted in a textbox.

now there are 2 items that get deleted one is from a file and the other item is a folder on a remote machine. I have the dashed lines separating the 2 and the thrid is just displaying what was deleted in a diaplogbox that pops up.

I m new to programming and i have been trying to use a loop but i seem to just get one item. Any help would be great.

Private Sub DeleteHeapAndFolderToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteHeapAndFolderToolStripMenuItem.Click
    If strComputer = "" Then
        strComputer = "127.0.0.1"
    End If

    Dim heap_num = Radia_Listview.SelectedItems(0).Text 'heap number
    Dim Process = GetObject("winmgmts://./root/novadigm:NVD_Agent")
    Dim method = Process.Methods_("DeleteInstance")
    Dim inParameters = method.inParameters.SpawnInstance_()
    inParameters.Path = "c:\temp\aservice.edm"
    inParameters.Index = heap_num
    Dim outParameters = Process.ExecMethod_("DeleteInstance", inParameters)
    '---------------------------------------------
    Dim Zdelete = Radia_Listview.SelectedItems(0).SubItems(1).Text ' heap name.
    Dim ZPATH As String = "\\" & strComputer & "\C$\Progra~1\Novadigm\Lib\SYSTEM\RADDBT3\SOFTWARE\ZSERVICE\"
    If System.IO.Directory.Exists(ZPATH & Zdelete) Then
        Directory.Delete(ZPATH & Zdelete, True)
    End If
    Dim copyFrom As String = "C:\temp\ASERVICE.EDM"
    Dim copyTo As String = "\\" & strComputer & "\C$\Progra~1\Novadigm\Lib\SYSTEM\RADDBT3\SOFTWARE\ASERVICE.EDM"
    File.Copy(copyFrom, copyTo, True)
    '----------------------------------------------
    Del_Heap.Del_TextBox.Text = Zdelete
    Del_Heap.Show()
        Radia_Listview.Items.Clear()
    Application.Radia_Query_Aservice_Button.PerformClick()
End Sub

推荐答案

\ Progra〜1 \ Novadigm \ Lib \ SYSTEM \ RADDBT3 \ SOFTWARE \ ZSERVICE \" 如果 System.IO.Directory.Exists(ZPATH& Zdelete)然后 Directory.Delete(ZPATH和Zdelete,) 结束 如果 Dim copyFrom As 字符串 = " copyTo As 字符串 = " & str计算机"
\Progra~1\Novadigm\Lib\SYSTEM\RADDBT3\SOFTWARE\ZSERVICE\" If System.IO.Directory.Exists(ZPATH & Zdelete) Then Directory.Delete(ZPATH & Zdelete, True) End If Dim copyFrom As String = "C:\temp\ASERVICE.EDM" Dim copyTo As String = "\\" & strComputer & "\C


\ Progra〜1 \ Novadigm \ Lib \ SYSTEM \ RADDBT3 \ SOFTWARE \ ASERVICE.EDM" File.Copy(copyFrom,copyTo,) ' ------------------------- --------------------- Del_Heap.Del_TextBox.Text = Zdelete Del_Heap.Show() Radia_Listview.Items.Clear() Application.Radia_Query_Aservice_Button.PerformClick() 结束 Sub
\Progra~1\Novadigm\Lib\SYSTEM\RADDBT3\SOFTWARE\ASERVICE.EDM" File.Copy(copyFrom, copyTo, True) '---------------------------------------------- Del_Heap.Del_TextBox.Text = Zdelete Del_Heap.Show() Radia_Listview.Items.Clear() Application.Radia_Query_Aservice_Button.PerformClick() End Sub


我自己修复了此问题:


I fixed this myself:


'=======================================================================================
'The below code will create an array for the items that need to be deleted from Zservice
'=======================================================================================

' Delcaring the selected items as heap_num
Dim Zheap_num = CAE_Listview.SelectedItems(0).SubItems(1).Text ' heap name
Dim ZPATH As String = "\\" & strComputer & "\C


这篇关于帮助使用多个选定的列表视图项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆