If you are building something in accordance with the basic forms, as you describe, you really need to develop an architecture with a certain level of business and data. Your actual functionality and manipulations should be divided into a class library created specifically for processing abstracted information / operations. The same thing with calls and data processing. They should be abstracted into a separate library, which is responsible for managing the input / output operations with your data sources.
This means that the code in your actual form comes down to the elements that are really necessary to control the display and direct behavior (clicks, rollovers, menus, etc.). Even some of them can be combined if you effectively manage form states. The bottom line is that you want to get away from the form as much as possible and leave the form responsible for the immediate display.
source share