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

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
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.