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?
Printable View
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?
What is it you're trying to write and how are you doing it?
You mean you want the formatting to show?
[Edited by Megatron on 08-21-2000 at 03:03 PM]Code:RichTextBox1.LoadFile "MyFile", rtfText
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
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