Results 1 to 5 of 5

Thread: How do you write to a richtextbox?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Fremont Ohio 43420
    Posts
    253

    Question

    I would like to write to a richtextbox but it doesn't like it when I specify the font and all the headings and other stuff I would like to have appear inside the richtextbox. Can anyone help?

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    What is it you're trying to write and how are you doing it?

  3. #3
    Guest
    You mean you want the formatting to show?
    Code:
    RichTextBox1.LoadFile "MyFile", rtfText
    [Edited by Megatron on 08-21-2000 at 03:03 PM]

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2000
    Location
    Fremont Ohio 43420
    Posts
    253

    Heres what I'm trying to write.

    Private Sub PrintToObject()

    Dim ctlname As String
    Dim thisctl As Control
    Dim FIN As Double
    Dim BEG As Double
    Dim w As Double
    Dim w2 As Double
    Dim w3 As Double
    Dim c1 As Double
    Dim c2 As Double
    Dim c3 As Double
    Dim J As Integer

    'print headings
    PrtObj.Font = "Courier"
    PrtObj.FontSize = 14
    PrtObj.Print 'Blank Line
    PrtObj.Print Space(64) & frmCubeCupMain.txtDate
    PrtObj.Print 'Blank Line
    PrtObj.Print Space(30) & "Cube Cup" & Space(2) & "*" & Space(2) & frmCubeCupMain.txtCubeCupName & _
    Space(2) & "*"
    PrtObj.Print 'Blank Line
    PrtObj.Print 'Blank Line
    PrtObj.Print 'Blank Line
    PrtObj.Print Space(5) & "Grams" & Space(4) & "Cube Wt." & Space(6) & "Grams" & _
    Space(5) & "Cube Wt." & Space(7) & "Grams" & Space(6) & "Cube Wt."
    PrtObj.Print 'Blank Line

    'calculations
    FIN = 280
    BEG = FIN - 20.5

    For w = BEG To FIN Step 0.5
    w2 = w + 21
    w3 = w2 + 21
    c1 = w / (frmCubeCupMain.txtCVNumber * 0.06102338)
    c2 = w2 / (frmCubeCupMain.txtCVNumber * 0.06102338)
    c3 = w3 / (frmCubeCupMain.txtCVNumber * 0.06102338)

    PrtObj.Print Tab(6); Format(w, "##0.0"); Tab(16); Format(c1, "#0.0"); _
    Tab(29); Format(w2, "##0.0"); Tab(40); Format(c2, "#0.0"); _
    Tab(54); Format(w3, "##0.0"); Tab(66); Format(c3, "#0.0")

    J = J + 1
    If J = 6 Then
    PrtObj.Print
    J = 0
    End If

    Next w

    If ctlname = "PrtObj" Then
    MsgBox "Click okay to view more"
    thisctl.Cls
    End If

    End Sub

  5. #5
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    The Print statement can be used on Form, Printer and PictureBox objects it can't be used with a RTF box.
    The type text in a RTF box use one or more of the following properties:
    • Text
    • SelText
    • TextRTF
    • SelRTF

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width