Public Sub GetAllControls(ByVal InContainer As Control, ByRef RecieveList As ListBox)
创新互联-专业网站定制、快速模板网站建设、高性价比界首网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式界首网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖界首地区。费用合理售后完善,十多年实体公司更值得信赖。
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
这段代码可行,但不能遍历菜单和工具栏,要按需要修改
因为它是网银的驱动,当网银没插入时,自然不会有任何提示,因为网银的驱动让我装在了。外置优盘里。外置的u盘,要想运行,系统,不依靠别的介质是不行的。
解压密码:1299
假设路径为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
详见源代码!!