VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Make color tags in a rchtext box

by Anonymous (267 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Wed 24th February 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Make color tags in a rchtext box

Rate Make color tags in a rchtext box



Dim txt As String
Dim tag_open As Integer
Dim tag_close As Integer

    txt = rch.Text
    tag_close = 1
    Do
        ' See where the next tag starts.
        tag_open = InStr(tag_close, txt, "<")
        If tag_open = 0 Then Exit Do
        
        ' See where the tag ends.
        tag_close = InStr(tag_open, txt, ">")
        If tag_open = 0 Then tag_close = Len(txt)
        
        ' Color the tag.
        rch.SelStart = tag_open - 1
        rch.SelLength = tag_close - tag_open + 1
        rch.SelColor = vbRed
    Loop
End Sub

Download this snippet    Add to My Saved Code

Make color tags in a rchtext box Comments

No comments have been posted about Make color tags in a rchtext box. Why not be the first to post a comment about Make color tags in a rchtext box.

Post your comment

Subject:
Message:
0/1000 characters