Wednesday 3 November 2021

How to Load data from a text file to RichTextBox control using Dialog Co...

How to Load data from Text (.txt) and RTF (.rtf) file to Richtextbox control using Common Dialog control in Visual Basic 6 .Also Clear the richtextbox control.Visual Basic Tutorial-Step by step Tutorial,No Step skipped. In the Part-1 of this Video, we will discuss following points 1.How to add Richtextbox and Common Dialog Control in the Visual Basic Project. 2.How to Use Richtextbox and Common Dialog Control and set their properties. 3.How to load data from a text file to Richtextbox using Open Dialog control and Command Button.In open Dialog, we will select any text file from the PC and Open that file content into the richtextbox control. 4.How to clear the richtextbox. All steps are explained in detail,no step is skipped . Next Part-2 ,we will discuss about Saving data from a richtextbox to a text .txt file and RTF .rtf file and store in PC.  
 Code: 
Dim data As String
 Private Sub loadbtn_Click() 
opendialog.Filter = "Text File(*.txt)|*.txt|RTF File(*.rtf)|*.rtf|" 
opendialog.ShowOpen
 data = opendialog.FileName RichTextBox1.LoadFile (data)
 End Sub

 Private Sub clearbtn_Click() 
RichTextBox1.Text = ""
 End Sub

3 comments:

  1. Dell Laptop Service Center in Chandigarh
    provides best laptop repairs and services to all the Dell laptop users. They offer a wide range of repair options for Dell laptops including, but not limited to: -Screen replacement -Data recovery -Motherboard/CPU replacements -Liquid damage repair The team at Dell Laptop service center in Chandigarh is highly skilled and certified in repairing all types of Dell laptops. All the repairs are done using latest technology and tools ensuring that your laptop is back to its original working condition.

    ReplyDelete
  2. Lenovo laptop services in India's Metro cities.

    ReplyDelete