Categories
ASP.NET 1.1 VB.NET

Organize your code with Region

When you have many related functions, you can consider to group them together using Region.

Example, if you have four functions which are related to Paging, you can just add a region like below (ASP.NET 1.1, VB.NET syntax):

#Region "Paging"

Public Property CurrentPage() As Integer
' Your code here ...
End Property

Private Sub ImgBtnPrevBottom_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImgBtnPrevBottom.Click
' Your code here ...
End Sub

Private Sub ImgBtnNextBottom_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImgBtnNextBottom.Click
' Your code here ...
End Sub

Private Sub ItemsGet()
' Your code here ...
End Sub

#End Region


Now, go to your Visual Studio 2003. Click Edit > Outlining > Collapse to Definitions, you will see the below:

Print Screen - Region

It is very simple to do, yet useful.

Leave a Reply

Your email address will not be published. Required fields are marked *

*