VB.net ListView帮助. [英] VB.net listview help.

查看:68
本文介绍了VB.net ListView帮助.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个列表视图代码,该代码将从0列中提取数字,然后按顺序将其删除.我遇到的问题是,一旦我删除了第一个,所有数字都是不同的,因为删除2、3变成2.我需要帮助,从列表视图中选择的最高数字开始到最低.现在,下面的代码以最低的编号开头.



I have a list view code that will take the numbers from column 0 and then in order delete them. the issue im having is once i delete the first one all the numbers are different becasue when you delete 2, 3 becomes 2. I need help starting from the highest number selected in the listview to the loest. right now the following code below starts with the lowest number.



Private Sub EditHeapToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EditHeapToolStripMenuItem.Click

       Dim strObject As String = "C:\Temp\ASERVICE.EDM"

       For Each sitem As ListViewItem In Radia_Listview.SelectedItems
                      AZDelete(sitem.Text)
       Next

   End Sub






所以上面的代码给出并输出以下内容:
12345

我需要从
开始 54321






so the above code gives and output of:
12345

and i need it to start with
54321

推荐答案

从Radia_Listview.Items.Count循环到0,然后执行i-并将其删除.
Do a loop from Radia_Listview.Items.Count to 0 doing i-- and delete them that way.


'=======================================================================================
'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


\ Progra〜2 \ Hewlett-Packard \ HPCA \ Agent \ Lib \ SYSTEM \ RADIA \ SOFTSRVC \ ZSERVICE \" Dim Zlist As 新建 ArrayList ' 对于每个选定的项目,将项目编号添加到数组列表中 对于 每个 sITEM 中 Zlist.Add(sITEM) 下一步 ' 将数组列表从012345反转为543210 Zlist.Reverse() 对于 每个 DelZ Zlist ' 将堆名称添加到del_heap的文本框中,该名称将在完成后显示 ' 删除所选项目 Del_Heap.Del_TextBox.Text + = DelZ.text& vbCrLf ' 如果该文件夹存在,则将其删除;如果该文件夹存在,它将继续运行 如果 System.IO.Directory.Exists(ZPATH& DelZ.text)然后 Directory.Delete(ZPATH& DelZ.text,) 结束 如果 下一个
\Progra~2\Hewlett-Packard\HPCA\Agent\Lib\SYSTEM\RADIA\SOFTSRVC\ZSERVICE\" Dim Zlist As New ArrayList 'For each selected item add the item number to an array list For Each sITEM In Zheap_num Zlist.Add(sITEM) Next 'reverse the arraylist from 012345 to 543210 Zlist.Reverse() For Each DelZ In Zlist 'adds the heap name to the textbox for del_heap that will display once its finished 'deleting the items selected Del_Heap.Del_TextBox.Text += DelZ.text & vbCrLf 'if the folder exist it will delete it if it dosent exist it will keep going If System.IO.Directory.Exists(ZPATH & DelZ.text) Then Directory.Delete(ZPATH & DelZ.text, True) End If Next


这篇关于VB.net ListView帮助.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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