注册 登录
编程论坛 VB.NET论坛

為什么不能夠打開

jxyga111 发布于 2008-09-22 11:00, 844 次点击
Function openfile() As String
        OpenFileDialog1.Title = "open dialog"
        '定義文件過濾器的屬性
        OpenFileDialog1.Filter = "rich text file |*.rch |*.txt"
        OpenFileDialog1.ShowReadOnly = True
        If OpenFileDialog1.ShowDialog = DialogResult.OK Then
            openfile = OpenFileDialog1.FileName
        Else
            openfile = ""
        End If
請幫忙解決
2 回复
#2
qlong07282008-09-22 15:20
Open.Filter = "rich text file |*.rch |*.txt"
Open.FilterIndex = 2
Open.ShowDialog()
#3
jxyga1112008-09-22 15:41
謝謝解決了
Function openfile() As String
        OpenFileDialog1.Title = "open dialog"
        '定義文件過濾器的屬性
        OpenFileDialog1.Filter = "*.txt|*.txt"
        OpenFileDialog1.ShowReadOnly = True
        If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then

            openfile = OpenFileDialog1.FileName
        Else
            openfile = ""
        End If
1