Results 1 to 28 of 28

Thread: [RESOLVED] Parsing and coloring the VB CODES in my Richtextbox [SUGGESTIONS & HELP NEEDED]

Threaded View

  1. #1

    Thread Starter
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Resolved [RESOLVED] Parsing and coloring the VB CODES in my Richtextbox [SUGGESTIONS & HELP NEEDED]

    Hi all...

    I am trying to create a small vb6 code viewer.Which will simply display the VB6 codes in color coded form. See below for an example:
    vb Code:
    1. Option Explicit
    2.  
    3. Private Sub Command1_Click()  '~~~ Search button
    4.   Dim i As Long
    5.  
    6.   List2.Clear '~~~> Empty everything
    7.   For i = 0 To List1.ListCount - 1  '~~~> Loop through the list in 1st Listbox
    8.     If InStr(1, List1.List(i), Trim$(Text1.Text), vbTextCompare) <> 0 Then  '~~> Checking for the entry
    9.       List2.AddItem List1.List(i) '~~~> If found, add it to the 2nd Listbox
    10.     End If
    11.   Next i
    12. End Sub
    13.  
    14. Private Sub Form_Load()
    15.   '~~~ Load the listbox with sample data
    16.   List1.AddItem "D:\MUSIC\Music Collection Updated\Akon ft nas - locked up rmx.mp3"
    17.   List1.AddItem "D:\MUSIC\Music Collection Updated\Ciara - Oh.mp3"
    18.   List1.AddItem "C:\MUSIC\Music Collection Updated\Fabolous - Can U hear me.mp3"
    19.   List1.AddItem "C:\MUSIC\Music Collection Updated\Fabolous - Cant_let_you_go.mp3"
    20. End Sub
    Here, the reserved words are set with the blue color, comments with green, constants(numbers) with pink and text with brown.

    How can I implement the same coloring methods in my own VB6 code viewer..????

    Any ideas...???
    Thanks....

    Edit:
    I know the basic methods for finding and changing words by using Find method of RichTextBox and some basic manipulations using InStr(), Mid(), Replace(), etc...
    But I was looking for something that is more efficient and speedy, because the code might be of large lines....
    For displaying the VBCode, I will be using a RichtTextbox...
    Thanks...
    Last edited by akhileshbc; Mar 19th, 2010 at 06:49 AM. Reason: added more information

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

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