⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 这里有很多很实用的VB编程案例,方便大家学习VB.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "文件列表"
   ClientHeight    =   3945
   ClientLeft      =   1995
   ClientTop       =   1650
   ClientWidth     =   5115
   LinkTopic       =   "Form1"
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   3945
   ScaleWidth      =   5115
   Begin VB.ListBox List2 
      Height          =   2580
      Left            =   120
      Sorted          =   -1  'True
      TabIndex        =   5
      Top             =   600
      Width           =   4935
   End
   Begin VB.CommandButton Command1 
      Caption         =   "文件列表"
      Height          =   375
      Left            =   1440
      TabIndex        =   4
      Top             =   120
      Width           =   1215
   End
   Begin VB.DriveListBox Drive1 
      Height          =   300
      Left            =   120
      TabIndex        =   3
      Top             =   120
      Width           =   1095
   End
   Begin VB.DirListBox Dir1 
      Height          =   510
      Left            =   120
      TabIndex        =   2
      Top             =   3360
      Visible         =   0   'False
      Width           =   1455
   End
   Begin VB.FileListBox File1 
      Height          =   450
      Left            =   1680
      TabIndex        =   1
      Top             =   3360
      Visible         =   0   'False
      Width           =   1935
   End
   Begin VB.ListBox List1 
      Height          =   420
      Left            =   3600
      TabIndex        =   0
      Top             =   3360
      Visible         =   0   'False
      Width           =   1455
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Height          =   180
      Left            =   2760
      TabIndex        =   6
      Top             =   120
      Width           =   90
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Command1_Click()
    List1.Clear
    List2.Clear

    Dir1.Path = Left$(Drive1.Drive, 2) + "\"
    File1.Path = Dir1.Path

    For t& = 0 To File1.ListCount - 1
        List2.AddItem Dir1.Path + File1.List(t&)
    Next

    For t& = 0 To Dir1.ListCount - 1
        List1.AddItem Dir1.List(t&)
    Next
    If t& <> 0 Then
        cnt& = 0
        Do
            Dir1.Path = List1.List(cnt&)
            File1.Path = Dir1.Path

            For t& = 0 To Dir1.ListCount - 1
                List1.AddItem Dir1.List(t&)
            Next

            For t& = 0 To File1.ListCount - 1
                List2.AddItem Dir1.Path + "\" + File1.List(t&)
            Next

            cnt& = cnt& + 1
            If cnt& = List1.ListCount Then
                Exit Do
            End If
        Loop
    End If
    Label1.Caption = "Total:" + Str$(List2.ListCount)
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -