DO NOT DEAL WITH THIS MEMBER
Quote:As most of you already know, in C# you are able to use #Regions in Subs & Functions. This feature, however, is not available in VB.Net. This little tip is an alternative to #Regions & I hope that you guys find this tip useful.
dunno where you got your info from there because you have always been able to use regions in vb
DO NOT DEAL WITH THIS MEMBER
(Jul 3, 2015 08:40 AM)nathan72389 Wrote: dunno where you got your info from there because you have always been able to use regions in vb
As I said, you cannot use Regions in a Sub or Function.
Wow. Learned something new. Thanks!
Jul 3, 2015 11:23 AM
(This post was last modified: Jul 3, 2015 11:27 AM by VmX5.)
Umm... You can use regions in Vb.net but just not in Subs
i.gyazo.com/93c34d268f8278a834139e5478fcf18d.png
i.gyazo.com/d5cefaf2794c56b4408557e548e714fe.png
Read the Thread again... Nvm.
Jul 3, 2015 11:42 AM
(This post was last modified: Jul 3, 2015 11:42 AM by SIM-1676753.)
I don't use regions at all. Split them into folders with their corresponding functionality, like a forms folder for forms, helpers for utilities, models for objects, etc.
as well as comments if needed.
Jul 3, 2015 11:42 AM
(This post was last modified: Jul 3, 2015 11:47 AM by +Haze.)
Nice contribution, but I'm afraid there is a lot more to organizing your code than just using regions. Using regions is probably the last step in my opinion to organizing code, and it's something that is not available for other IDEs so there must be more universal ways for writing organized code. Here's my tips on organizing code.
1) Use a certain design architecture when creating applications, such as the three tier application model or MVC.
2) Follow and stick to the naming conventions set by Microsoft
3) Make use of folders, group similar files into folders. For example, create a folder called Forms where you put all your forms in.
4) Comment, comment and comment your code.
5) Modular and reuse your code, make great use of object oriented programming, and design classes that are modular.
6) Make use of the single responsibility principals, each class should do one thing and one thing only.
7) Ensure your classes are easily maintainable and scale-able
8) Never ever ever put your business logic code and your data access code in the same class or folder, they should both be seperated.
9) Make use a abstract classes
10) Follow the S.O.L.I.D design principals of OOP design
http://www.codeproject.com/Articles/7036...ple-Csharp
you propably should simply rename the thread to: "How to create regions inside a method in vb.net"
DO NOT DEAL WITH THIS MEMBER
(Jul 3, 2015 12:59 PM)DisguiserNET Wrote: you propably should simply rename the thread to: "How to create regions inside a method in vb.net"
Yeah, that is a better title. I have now changed it.
Nice Tutorial, Read it like 3 times.
The first 2 times I read this I thought you said that we couldn't make #Regions anywhere :P
If your subs/functions are getting so out of control that you need to add regions within them, then you are doing something wrong.
(Jul 4, 2015 02:45 AM)$lick Wrote: If your subs/functions are getting so out of control that you need to add regions within them, then you are doing something wrong.
if you are used to big screens and then have to work on your netbook, regions are quite usefull
Jul 4, 2015 09:45 PM
(This post was last modified: Jul 4, 2015 09:46 PM by Menalix.)
#Region is the worst way to organize code, in my opinion, I think it more helps in de-organizing the code.
(Jul 4, 2015 02:45 AM)$lick Wrote: If your subs/functions are getting so out of control that you need to add regions within them, then you are doing something wrong.
+1 on this.
You should rather split code from your subs/functions into more subs/functions, and use them in the first sub/function which was so huge you needed regions lol, much better organization.
DO NOT DEAL WITH THIS MEMBER
(Jul 4, 2015 09:45 PM)Menalix Wrote: #Region is the worst way to organize code, in my opinion, I think it more helps in de-organizing the code.
+1 on this.
You should rather split code from your subs/functions into more subs/functions, and use them in the first sub/function which was so huge you needed regions lol, much better organization.
Agreed. I tend to use Regions only when grouping e.g a function set or properties, but never as a substitute of what could be a class or method itself.
(Jul 4, 2015 09:45 PM)Menalix Wrote: #Region is the worst way to organize code, in my opinion, I think it more helps in de-organizing the code.
+1 on this.
You should rather split code from your subs/functions into more subs/functions, and use them in the first sub/function which was so huge you needed regions lol, much better organization.
I agree with the bottom statement not with the top though. Regions are useful for code organization. I like to separate my functions, declarations, and properties for one. It is definitely helpful in making your code easier to understand.
|