# How to collapse code blocks in VB.NET or C# (VS.NET 2k3)

This topic is 4703 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi, Quick question.. is there anyway to collapse loops, if statements, etc in VB.NET? What about C#? I'd be very surprised if this was possible in C++ but not in these 2 languages, but it seems thats how it is by default... anyone know how to turn this on? Thanks.

##### Share on other sites
The The VS beta supports code collapsing, and with Visual Assist [by Whole Tomato Software, I believe...finding a link shouldn't be too hard] you can get it in previous versions.

Several alternative IDEs support it as well. I think Eclipse does, for instance.

CM

##### Share on other sites
If nothing else, you can use manually specified regions to do the same thing.
//C#:#region Name/Description of Region#endregion//C++:#pragma region Name/Description of Region#pragma endregion

Don't know what VB's syntax is, but I'm sure it exists.

But maybe you already know such things exist, since you were asking specifically about code blocks, and were probably looking for automatic collapsing ability. I unfortunately can't help you with that.

I should note that I do not know if this works with 2003; I've skipped from 6.0 to 2005 beta, so that's all I know about.[/edit]

##### Share on other sites
I know that in VS.NET 2003, code collapsing works with C++, just not with VB.NET or C#... this gets very annoying since I'm so spoiled by the collapsing in C++... VB.NET is ugly enough as it is, why the hell can't I collpase the code? [grin]. Anyway, just trying to clear up, are you confirming that it doesn't work w/ VB.NET in 2k3? Or ...

Quote:
 Original post by Conner McCloudThe The VS beta supports code collapsing, and with Visual Assist [by Whole Tomato Software, I believe...finding a link shouldn't be too hard] you can get it in previous versions.Several alternative IDEs support it as well. I think Eclipse does, for instance.CM

##### Share on other sites
Quote:
 Original post by AgonyIf nothing else, you can use manually specified regions to do the same thing.//C#:#region Name/Description of Region#endregion//C++:#pragma region Name/Description of Region#pragma endregionDon't know what VB's syntax is, but I'm sure it exists.But maybe you already know such things exist, since you were asking specifically about code blocks, and were probably looking for automatic collapsing ability. I unfortunately can't help you with that.I should note that I do not know if this works with 2003; I've skipped from 6.0 to 2005 beta, so that's all I know about.[/edit]

Thanks for the reply... yeah, I know thats possible, but I'd much rather be able to automatically collpase loops and if statements, it comes in handy and can actually prevent bugs...

I'm finding it VERY hard to believe that I can collapse ifs and loops in C++ but not in the other, high level languages!!! Google is not helping me and I know this must be possible...

Thanks for any more help.

bump?

1. 1
Rutin
23
2. 2
3. 3
JoeJ
20
4. 4
5. 5

• 28
• 40
• 23
• 13
• 13
• ### Forum Statistics

• Total Topics
631738
• Total Posts
3001950
×