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

3 comments:

  1. Thank you for sharing the information. Besides if you need experts for any kinds of problem with your PC/ Laptop the search for pc reparatur Frankfurt. ITFux24 can help you from to to bottom.

    ReplyDelete
  2. abv4396506
    abq0945985
    qx8728358
    kp1216559
    qr5531647
    kt0008676
    ve2405317
    su7972597
    qk2376311
    acd1845340
    xq4296810
    abg5614133
    th6524921
    zw5705740
    zw3626733
    aag3558531
    aac5220968
    yb6735443
    rg3143874

    ReplyDelete
  3. Interesting article! Thank you for sharing them! I hope you will continue to have similar posts to share with everyone.

    Internet Recovery MAC

    ReplyDelete