Open RTF file in Visual Basic .Net

Download
Download is available until [expire_date]
  • Version
  • Download 49
  • File Size 104.88 KB
  • File Count 1
  • Create Date March 11, 2016
  • Last Updated March 11, 2016

Open RTF file in Visual Basic .Net

Open RTF file in Visual Basic .Net

RTF is a text file format used by Microsoft products, such as Word and Office. RTF, or Rich Text Format, files were developed by Microsoft in 1987 for use in their products and for cross-platform document interchange. RTF is readable by most word processors.

In this vb.net program you are allowed to search for rtf files on your computer and open or view it in visual basic form using the rich text format control. The program will also retrieve or display the path of the file, the filename and the file size.

Source code:

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        OpenFileDialog1.Filter = "RTF Files(*.rtf)|*.rtf"
        If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
            Dim getfilesize As System.IO.FileInfo
            Label1.Text = OpenFileDialog1.FileName
            Label2.Text = OpenFileDialog1.SafeFileName

            getfilesize = My.Computer.FileSystem.GetFileInfo(Label1.Text)
            Label3.Text = "File is " & getfilesize.Length & " bytes."

            RichTextBox1.LoadFile(OpenFileDialog1.FileName)
        End If
    End Sub
End Class
, , ,

Post navigation

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.