【问题标题】:vb.net i can't choose pdf filesvb.net 我无法选择 pdf 文件
【发布时间】:2017-07-19 11:39:18
【问题描述】:

在 vb.net 中,我创建了一个简单的方法,我在其中选择并查看(pdf 和图像文件),我使用了 fileopendialog 这是我的代码

Private Sub btn_parcour_Click(sender As Object, e As EventArgs) Handles btn_parcour.Click
    fichier.Filter = "PDF Files |* .pdf "
    If fichier.ShowDialog = DialogResult.OK Then
        fichier_txt.Text = fichier.FileName
    End If
End Sub

但是当我打开文件对话框来选择文件时,我不能这样做,因为消息是你没有文件

这是一个屏幕

enter image description here

【问题讨论】:

  • 去掉星号后面的空格。
  • 同样的结果
  • 以及星号之后和管道符号之前的空格

标签: vb.net pdf openfiledialog


【解决方案1】:

过滤器中的空格太多。它会抛出模式匹配。

'Remove all the extra spaces
fichier.Filter = "PDF Files|*.pdf"

例如,如果做 pdf 和所有其他文件

'Note no stray spaces where they are not needed
fichier.Filter = "PDF Files|*.pdf|All files(*.*)|*.*"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-26
    • 1970-01-01
    • 2021-05-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-28
    相关资源
    最近更新 更多