Results 1 to 3 of 3

Thread: Prettier Code

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2015
    Posts
    6

    Prettier Code

    So i made a program and would like to organize the code to make it easier for other programmers to read, how would i add collapsible groups of private subs, replacing the commented bits in the following code:
    Code:
        'Move Window
        Private Sub Form1_MouseDown(sender As Object, e As MouseEventArgs) Handles Me.MouseDown
            DragMouseDown()
        End Sub
        Private Sub Form1_MouseMove(sender As Object, e As MouseEventArgs) Handles Me.MouseMove
            DragMouseMove(Me)
        End Sub
        Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Me.MouseUp
            DragMouseUp()
        End Sub 
        'Move Window End
    also if there where a way to group the groups of subs into another group that'd be great

  2. #2
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,712

    Re: Prettier Code

    Encapsulate your code blocks in regions.
    VB Code:
    1. #Region "Move Window"
    2.  
    3.      'put move window code here
    4.  
    5. #end Region

    You can then nest as many regions as you need to make it pretty as a frog

    kevin
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2015
    Posts
    6

    Re: Prettier Code

    Thanks, will help a lot

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