-
I have this code in button_click event
Code:
Dim strRTF As String, strFontName As String, lngFontColor As Long, lngFontSize As Long
Dim blnBold As Boolean, blnUnderline As Boolean, blnItalic As Boolean
'get font-styles so we can reset them later
blnBold = RtbText.SelBold
blnUnderline = RtbText.SelUnderline
blnItalic = RtbText.SelItalic
lngFontColor& = RtbText.SelColor
lngFontSize& = RtbText.SelFontSize
strFontName$ = RtbText.SelFontName
strRTF$ = RtbText.TextRTF
''clear textbox
RtbText.Text = ""
''reset font-styles
RtbText.SelBold = blnBold
RtbText.SelUnderline = blnUnderline
RtbText.SelItalic = blnItalic
RtbText.SelColor = lngFontColor&
RtbText.SelFontSize = lngFontSize&
RtbText.SelFontName = strFontName$
''show bottom half of textbox
rtbChat.SelStart = Len(rtbChat.Text)
rtbChat.SelLength = 0
'print text in our rtbChat
rtbChat.SelRTF = vbCrLf & strRTF$
Debug.Print strRTF$
'scroll rtbChat down
rtbChat.SelStart = Len(rtbChat.Text)
rtbChat.SelLength = 0
'set focus
RtbText.SetFocus
The issue at hand here is when I type in the box again and click the button it justs adds the text it doesnt insert the equivelent of vbCrlf . How can I accomplish that ?
Thanks for having a look ,
[]Private[]
-
Code:
'print text in our rtbChat
RTBChat.SelRTF = vbCrLf & strRTF$
Debug.Print strRTF$
'Add this code to your control here
RTBChat.Text = RTBChat.Text + vbCrLf
'scroll rtbChat down
RTBChat.SelStart = Len(RTBChat.Text)
RTBChat.SelLength = 0
-
I tried that and I end up with it the first line I type getting entered ,but the next line doesn't show and it reprints the first line skipping a space like this ;
Test
Test
I hope I made that clear . anyother ideas ? What about a RTF code for a vbcrlf ?
-
Hmmm,
I tried that code myself, and it worked fine!?!
Let me copy your code again and try it...
Get back to you later.
-
I must not be resetting something back then .
Thanks for the confirmation . I must have issues elsewhere .
-
Yeah, you must be changing it in another part of your code - from the code you posted it works fine
with the
RTBChat.Text = RTBChat.Text + vbCrLf