Results 1 to 6 of 6

Thread: [RESOLVED] improve my code

Threaded View

  1. #1

    Thread Starter
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    [RESOLVED] improve my code

    Hello
    Ive only been learning VB for a half year now so my knowledge is very ...basic ..., and I wrote this code to color all html tags (all words within < and >) within a rich text box in red...but I know its quite bad and I knew it wouldnt work when having ALOT of code...so can some of you pro's please improve it?

    Thanks

    VB Code:
    1. Dim start_p As Long
    2.     Dim end_p As Long
    3.     For a = 1 To Len(RT.Text)
    4.         If Mid(RT.Text, a, 1) = "<" Then
    5.             start_p = a
    6.         End If
    7.         If Mid(RT.Text, a, 1) = ">" Then
    8.             end_p = a
    9.             RT.SelStart = start_p - 1
    10.             RT.SelLength = (end_p - start_p)
    11.             RT.SelColor = RGB(255, 0, 0)
    12.         End If
    13.     Next a
    Last edited by Atheist; Nov 15th, 2005 at 05:18 PM.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

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