查看: 27  |  回复: 0
  VB6 得到文件夹内全部文件名
楼主
发表于 2025年3月2日 22:47

新建From1(窗体),新建List1(ListBox),Command1(按钮CommandButton),代码:

Private Sub Command1_click()
    List1.Clear
    Dim strFN$, strArr$(), i&

    strFN = Dir(App.Path & "\*.json")
    Do Until strFN = ""
        strArr = Split(strFN, "\")
        strFN = strArr(UBound(strArr))
        strFN = Left(strFN, Len(strFN) - 5)
        List1.AddItem strFN
        If LCase(strFN) = "abc" Then List1.ListIndex = i
        strFN = Dir
        i = i + 1
    Loop
End Sub


您需要登录后才可以回帖 登录 | 立即注册
【本版规则】请勿发表违反国家法律的内容,否则会被冻结账号和删贴。
用户名: 立即注册
密码:
2020-2025 MaNongKu.com