Public?Sub?GetAllControls(ByVal?InContainer?As?Control,?ByRef?RecieveList?As?ListBox)
創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比界首網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式界首網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋界首地區(qū)。費(fèi)用合理售后完善,十多年實(shí)體公司更值得信賴。
For?i?As?Integer?=?0?To?InContainer.Controls.Count?-?1
If?InContainer.Controls.Item(i).Text??""?Then
GetList.Items.Add(InContainer.Controls.Item(i).Text??vbCrLf)
End?If
If?InContainer.Controls.Item(i).Controls.Count??0?Then
GetAllControls(InContainer.Controls.Item(i),?GetList)
End?If
Next
End?Sub
這段代碼可行,但不能遍歷菜單和工具欄,要按需要修改
因?yàn)樗蔷W(wǎng)銀的驅(qū)動(dòng),當(dāng)網(wǎng)銀沒插入時(shí),自然不會(huì)有任何提示,因?yàn)榫W(wǎng)銀的驅(qū)動(dòng)讓我裝在了。外置優(yōu)盤里。外置的u盤,要想運(yùn)行,系統(tǒng),不依靠別的介質(zhì)是不行的。
解壓密碼:1299
假設(shè)路徑為C:\abc
代碼:
Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim Files As ObjectModel.ReadOnlyCollection(Of String) = My.Computer.FileSystem.GetFiles("C:\abc") Dim FileSize As Long, FileName As String = Nothing Dim oFileSize As Long For Each File As String In Files oFileSize = My.Computer.FileSystem.GetFileInfo(File).Length If oFileSize FileSize Then FileSize = oFileSize FileName = File End If Next Dim ListN As ListViewItem = New ListViewItem(My.Computer.FileSystem.GetName(FileName)) ListN.SubItems.Add(oFileSize " byte") ListN.SubItems.Add(My.Computer.FileSystem.GetFileInfo(FileName).Extension " 文件") ListN.SubItems.Add(FileName) ListView1.Items.Add(ListN) End SubEnd Class
詳見源代碼?。?/p>
網(wǎng)站標(biāo)題:vb.net遍歷list vbnet listview的用法
新聞來源:http://weahome.cn/article/dojchii.html