is there a way you can insert a line in a richtextbox? I have a command button that allows the user to insert a horizontal line in the richtextbox, but I don't know how to do it... another one... how do you put up a picture file in a richtextbox
Printable View
is there a way you can insert a line in a richtextbox? I have a command button that allows the user to insert a horizontal line in the richtextbox, but I don't know how to do it... another one... how do you put up a picture file in a richtextbox
Are you talking about a empty line? Simply do the following:
The VbCrLf places the empty line.Code:Public Sub Command1_Click()
RichTextBox1.Text = RichTextBox1.Text & VbCrLf
End Sub
Gl,
D!m
no no no... a horizontal line
---------------------------------------------------------
like the one above... but solid and in one piece so that the user can move it or delete it with one push of a keyboard key
RichTextBox1.Text = RichTextBox1.Text & vbCrLf _
& "__________________________________" & vbCrLf
It might be easier to place it into a Sub.
Code:Sub AddLine(rtfBox As RichTextBox, chChar As String, iLength As Integer)
rtfBox.SelText = vbCrLf & String(iLength, chChar) & vbCrLf
End Sub
Private Sub Command1_Click()
RichTextBox1.SetFocus
'AddLine (RichTextBox), (Character to Use), (Length)
AddLine RichTextBox1, "_", 20
End Sub