Question

With the #Region #End Region you can Minimize the information to take less room and organize it.

The question that I have is with in the Private Sub can you do the same thing?

https://i.stack.imgur.com/wjeoe.png

If you look at the Picture up above, were you see Text to speechhas + symbol next to it, I want to do the same thing but with in the Private Sub to help organize everything.

Était-ce utile?

La solution

It is possible (MSDN Reference). Just highlight the block of text you want to be collapsible and select:

"Outlining --> Hide Selection"

Then the selected block will collapse and give you [+] sign to expand/collapse it:

Autres conseils

Since we are not able to make collapsible regions within a Sub, you can make other Subs/Functions that you can call inside of the outer Sub. This would give a minimized look.

Add Summary Comments to these methods and they will help you remember what they do and what the parameters mean - if needed. Further Reading.

''' <summary>
''' What this method does!
''' </summary>
Private Sub DoSomething()
  'TODO: add code here
End Sub
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top