Region is a one of Microsoft directive. And what is directive? It is term that Microsoft use to describe .net command. One of benefit this directive is hide code if necessary.
Let's coding guys!
STEP 1: CREATE NEW WIN FORM PROJECT
Put in name for your new project.
STEP 2: START SOME CODES. Double click on Form 1 and write code as below:- Public Class Form1 'Step 2: declareclass Dim myClassExample As Little2moreClass Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub End Class 'step 1: create one class Public Class Little2moreClass ' this is testing class End Class
STEP 3: ADD REGION DIRECTIVE.
Add region directive as below:-
Public Class Form1
'Step 2: declareclass
Dim myClassExample As Little2moreClass
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
'USE REGION DIRECTIVE BELOW
#Region "hide"
'step 1: create one class
Public Class Little2moreClass
' this is testing class
End Class
#End Region
STEP 4: USE REGION DIRECTIVE Let's use this directive by clickin (-) symbol to hide the code or (+) to expand the code.
Enjoy your coding? Well congratulations!and keep learning and coding.
No comments:
Post a Comment