【问题标题】:Retrieve Data From a Folder从文件夹中检索数据
【发布时间】:2016-11-09 12:59:52
【问题描述】:

朋友们好, 我在 vb.net 中进行编码。我在一个文件夹中有一些 excel 文件。我希望所有文件都需要在 Windows 窗体应用程序中合并。但我想选择一个文件夹并检索所有文件。请问有人可以帮我吗?

【问题讨论】:

  • 到目前为止你做了什么?如果您还没有做任何事情,那么在这里发布问题还为时过早。首先,查找有关选择文件夹和从该文件夹中获取文件的信息需要几秒钟的时间。

标签: vb.net


【解决方案1】:

你可以在你的代码中尝试这样的事情:-

Dim fd As OpenFileDialog = New OpenFileDialog()
        fd.Title = "Select Excel File"
        'insert your drive specs here 'if specific directory is searched.
        fd.InitialDirectory = D_Drive + "\programs"
        fd.Filter = "All files (*.xls)|*.xls|All files (*.xls)|*.xls"
        fd.FilterIndex = 2
        fd.RestoreDirectory = True
        If fd.ShowDialog() = DialogResult.OK Then
            filec = fd.FileName
        End If

        If filec <> "" Then
            Shell("Excel " + filec, AppWinStyle.MaximizedFocus, True)
        End If

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-01-25
    • 1970-01-01
    • 1970-01-01
    • 2021-11-03
    • 2022-09-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多