Results 1 to 5 of 5

Thread: VB6 Code Formatter for VBForums

  1. #1

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

    Arrow VB6 Code Formatter for VBForums

    Hi all....

    If you have tried using the VBcode tags for posting codes in this forum, you can see that the end user can't copy it correctly as it can have line numbers and extra spaces when copied.
    So, I thought about creating a custom formatter and asked about it in here: http://www.vbforums.com/showthread.php?t=607914
    Based on the help from that thread (by those amazing guys), I managed to edit and regroup a project of Mark (http://www.a1vbcode.com/vbforums/Topic10851-12-1.aspx).
    Keyword list were copied from koolsid's VB6CodeGenerator Addin

    All credits goes to the respective owners... Thanks to them....

    Here's a demonstration of VBcode tags of the forum as well as the Formatted code...:

    [[ Actual Code ]] (using VBCode tags of this forum)
    vb Code:
    1. Option Explicit
    2.  
    3. '~~~~ VB6 code
    4. Private Sub Command1_Click()
    5.   Dim strTemp As String
    6.   Dim i As Long
    7.  
    8.   For i = 1 To 10
    9.     Debug.Print "Hai Guys...."  '~~~> Print the message
    10.   Next i
    11. End Sub

    [[ Formatted Code ]] (copy-pasted from code generated by my program)
    Code:
    Option Explicit
    
    '~~~~ VB6 code
    Private Sub Command1_Click()
      Dim strTemp As String
      Dim i As Long
      
      For i = 1 To 10
        Debug.Print "Hai Guys...."  '~~~> Print the message
      Next i
    End Sub
    I hope you all will like this code... Feel free to post your comments and suggestions...
    Attached Files Attached Files
    Last edited by akhileshbc; Mar 19th, 2010 at 11:31 PM. Reason: forgot to include the attachment.. :D

    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,...

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: VB6 Code Formatter for VBForums

    Cool! That could be a really useful program for members posting code on the forums.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: VB6 Code Formatter for VBForums

    What I'm afraid of is that all those tags are included when counting the length of the message by the forum software, limiting the length of code postings a lot.

  4. #4

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

    Re: VB6 Code Formatter for VBForums

    Quote Originally Posted by Nightwalker83 View Post
    Cool! That could be a really useful program for members posting code on the forums.
    Yeah...

    Quote Originally Posted by Merri View Post
    What I'm afraid of is that all those tags are included when counting the length of the message by the forum software, limiting the length of code postings a lot.
    Yeah... Do you have any solution for that...????

    Another thing is, for Internet Explorer users, there is no need of using this program. Because when the VBCodes are copied (in IE browser), it will automatically gets formatted and make sure that only codes are copied excluding the line numbers.(this information was provided(to me) by 'Ellis Dee'. Thanks to him.)
    I had tested it with IE8. And it's working....
    So, only FireFox users are experiencing the problem of line numbers, when VBCodes are copied...!

    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,...

  5. #5
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: VB6 Code Formatter for VBForums

    Well, using the way you do it, the only thing I can think of is to reduce the amount of color tags. For example, most of the words are blue, so what you could do is to define blue as the base color and then color only the other parts of the code. Also, color continuous segments of the same color only once!

    Your current sample code:
    • 16 blue tags
    • 2 green tags
    • = 18 total


    Using my suggestion:
    • One blue tag around everything
    • 5 black tags
    • 2 green tags
    • = 8 total


    Of course coding this optimization requires some thinking over, but that ought to be a nice learning experience


    You can also shorten the color tags: "#000099" can be represented as #009, reducing 5 characters. Each of your current tags takes 25 characters. If all optimizations are accounted for, then 18 * 25 = 450 characters is reduced to 8 * 20 = 160 characters. That is quite a remarkable difference for the exact same final visual representation The length of the actual code is only 194 characters so that would still almost double the length of the code...
    Last edited by Merri; Mar 21st, 2010 at 09:32 AM.

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