I don't get the following code perform correctly:

vb Code:
  1. Private Sub text2ADDText(xText As RichTextBox, fontN As String, fontS As Integer, fontI As Boolean, fontU As Boolean, fontB As Boolean, txt As String)
  2.     Dim text2Len As Long
  3.        
  4.     text2Len = Len(xText.Text)
  5.     xText.Text = xText.Text & vbCr & vbLf & txt
  6.     xText.SelStart = text2Len + 2
  7.     xText.SelLength = Len(txt)
  8.     xText.SelBold = fontB
  9.     xText.SelUnderline = fontU
  10.     xText.SelFontName = fontN
  11.     xText.SelFontSize = fontS
  12.    
  13. End Sub

It only produces the desired result in the last line added to the control invoking the sub.

Could you help me ...


El quijoteMx