0

here in the below coding i cant able to view the (.rtf) and (.doc) files
so kindly guide me with below coding

Imports System.IO
Public Class Form1
 
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Using fold As New OpenFileDialog
            fold.Filter = "document files (*.doc)|*.doc |richtext format(*.rtf) | *.rtf |All files (*.*)|*.*"
            fold.Title = "Select file"
            If fold.ShowDialog() = Windows.Forms.DialogResult.OK Then
                ' fold.FilterIndex = 2
                fold.RestoreDirectory = True
                MessageBox.Show("You selected " & fold.FileName)
            End If
        End Using
    End Sub
End Class
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by Pgmer
0

Try below code.. it works for me...

Dim fBrowse As New OpenFileDialog


        With fBrowse
            .Filter = "RTF files(*.rtf)|*.rtf|doc Files(*.doc)|*.doc|All files (*.*)|*.*"
            .FilterIndex = 1
            .Title = "Select any file"
        End With
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.