Results 1 to 2 of 2

Thread: automatically add <br> in to text2.text where ever there is a new line

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    May 2009
    Posts
    876

    automatically add <br> in to text2.text where ever there is a new line

    hi guys, is it possible that when i enter text into text1.text and press command1 it automatically adds "<br> at the end of the line where ever a new line is started? For example


    text1.text =

    "At the crown of the wig the hair is stitched in to the wig cap in such a way that it really adds to the authenticity of the wig making it look more natural than ever.

    This long wig is made from 100% Kanekalon synthetic fibre. Kanekalon is soft and silky and looks and feels just like real hair. The hair is sewn on to an adjustable lightweight netting cap which can be adjusted to fit most head sizes."

    I would like text2 to become :

    "At the crown of the wig the hair is stitched in to the wig cap in such a way that it really adds to the authenticity of the wig making it look more natural than ever.<br>

    This long wig is made from 100% Kanekalon synthetic fibre. Kanekalon is soft and silky and looks and feels just like real hair. The hair is sewn on to an adjustable lightweight netting cap which can be adjusted to fit most head sizes."


    Regards
    Jamie

  2. #2
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: automatically add <br> in to text2.text where ever there is a new line

    Use Replace function

    To totally replace new line
    Code:
    Private Sub Command1_Click()
        Text1.Text = Replace(Text1.Text, vbNewLine, "<br>")
    End Sub
    To insert <br> at each new line
    Code:
    Private Sub Command1_Click()
        Text1.Text = Replace(Text1.Text, vbNewLine, "<br>" & vbNewLine)
    End Sub



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