0

I've got my main form with four tabs on a tab control. Each tab contains about 1000-2000 lines of code and I would like to make this much neater.

Would this involve Modules? For example, I would like to store the code of 1 tab in a module or class ... (missing the term here). I would end up with 4 files containing the code of the 4 tabs and then I could simply include them...

Is it discouraged to do so? Perhaps it would create a problem when accessing some variables or functions?

Alex
  • 4,821
  • 16
  • 65
  • 106
  • 1
    Don't organize code into separate files based on the location of controls on the screen. Organize your code into discrete, independent classes based on the type of logic they perform. – Steven Doggart Feb 25 '13 at 21:24

1 Answers1

0

I figured out you can use

#Region "NameOfTheRegion"
#End Region

That works great, I took the suggestion of Steven Doggart and didn't split them up into different files. Instead I separated them by region using that code. Much easier to deal with it now.

Alex
  • 4,821
  • 16
  • 65
  • 106
  • 1
    With 2000 lines of code per tab and 4 tabs in total, your project is almost the size of mine, which is a core design tool for an insurance management system. Not sure what the purpose of your tabs is, but looks like it could have been separated into classes instead, and perhaps compacted into something more maintainable. 8000 lines of code in a single code file could be a maintainability nightmare. To get more or less unbiased view, consider running Calculate Code Metric from within Visual Studio, against your project. – Victor Zakharov Mar 04 '13 at 19:02