jr_barros_jr
asked on
Collapse Part of Code
Is there a way to create an outline or collapse part of code inside a function, like (if/end if) (for/next),(do/loop) etc using Visual Studio ?
thank tou
thank tou
put code in between and you can collapse it/expand it at will in vs
Regions are the way to go, however, as your Zone is marked Vb.NET, regions are more restricted in VB. You cannot place them inside of a method body (the sytax checker will complain). You can use regions to collapse groups of methods, though.
You also must give your region a name (as a quoted string).
You also must give your region a name (as a quoted string).
'Error
Sub Main()
#region "MyRegion"
For i As Integer = 0 To 16
Console.Write("a")
Next
#end region
End Sub
' Proper
#Region "MyRegion" <-- Must use quotes
Sub Main()
For i As Integer = 0 To 16
Console.Write("a")
Next
End Sub
Sub dosomething()
End Sub
#End Region
ASKER
Folks,
"'#Region' and '#End Region' statements are not valid within method bodies." (See attached picture)
So, #Region is only the solution outside "method". I would like to know inside sub, function, methods etc.
Any idea?
ExEx.png
"'#Region' and '#End Region' statements are not valid within method bodies." (See attached picture)
So, #Region is only the solution outside "method". I would like to know inside sub, function, methods etc.
Any idea?
ExEx.png
change the language you're programming - i.e. use c# instead...unfortunately vb.net does not allow this...
otherwise you could change IDE's i suppose to one that may parse and compile vb and take into consideration regions inside of a method...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
See previous comment.
ASKER
Is there any workaround for that?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
#endregion