Friday 12 November 2021

How to print content of a RichTextBox Control in Visual basic | Printing...

How to print content of a RichTextBox Control in Visual basic | Printing RichTextBox |Print to a pdf in this video, we will demonstrate how to print content of a RichTextBox Control in Visual basic 6. Printing RichTextBox Control content to a Pdf file . Step by step tutorial. In Visual basic 6, we can print content of a richtextbox control using printer and software to print data to a pdf file as well. This application will demonstrate 
Part:1 "How to Load data from a text file (RTF) to Richtextbox using Common Dialog Control and Richtextbox Control in Visual Basic" and How to Clear Rich Text Box Control. Link : https://youtu.be/32ITifBWJUI 
Part:2 How to Save Richtextbox data to a file using Common dialog control in Visual basic Link : https://youtu.be/oBJE3j2JJ1w
Part :3 How to Print Richtextbox content in visual basic and Print to a PDF file in visual basic . 
 Step by Step Tutorial No step is skipped  
 Code: 
Dim data As String
Dim filename As String


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

Private Sub loadbtn_Click()
opendialog.Filter = "Text Files (*.txt)|*.txt|RTf Files (*.rtf)|*.rtf|"
opendialog.ShowOpen
data = opendialog.filename
RichTextBox1.LoadFile (data)
End Sub

Private Sub printbtn_Click()
opendialog.CancelError = True
On Error GoTo CancelAlert
opendialog.Flags = cdlPDReturnDC + cdlPDNoPageNums
opendialog.ShowPrinter
RichTextBox1.SelPrint opendialog.hDC
Printer.EndDoc

CancelAlert:
Exit Sub

End Sub

Private Sub savebtn_Click()
opendialog.Filter = "Text Files (*.txt)|*.txt|RTf Files (*.rtf)|*.rtf|"
opendialog.ShowSave
filename = opendialog.filename
RichTextBox1.SaveFile filename, rtfText
End Sub

Monday 8 November 2021

How to save richtextbox data to a text file in visual basic | Export dat...

How to save richtextbox data to a text file in visual basic | Export data to a text file or RTF file | How to save richtextbox content to a file in visual basic |Visual Basic 6 Step by Step Tutorial In the Part:1, we have demonstrated "How to Load data from a text file (RTF) to Richtextbox using Common Dialog Control and Richtextbox Control in Visual Basic" and How to Clear Rich Text Box Control. In Part:2, we have discussed about "How to save Richtextbox data to a Text File or RTF file". All steps are explained in detail,no step is skipped while making this video tutorial. Step by Step Tutorial Code Dim data As String Dim check As Integer Dim filename As String Private Sub Command1_Click() opendialog.Filter = "Text Files (*.txt)|*.txt|RTf Files (*.rtf)|*.rtf|" opendialog.ShowOpen data = opendialog.filename ''check = Len(data) If opendialog.filename = "" Then MsgBox "You click on Cancel!! Kindly Select the file you want to load", vbOKOnly + vbCritical Else RichTextBox1.LoadFile (data) End If End Sub Private Sub findbtn_Click() opendialog.Filter = "Text Files (*.txt)|*.txt|RTf Files (*.rtf)|*.rtf|" opendialog.ShowSave filename = opendialog.filename RichTextBox1.SaveFile filename, rtfText End Sub

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