Can I split a Visual Basic (.NET / 2010) file into readability?

I am writing a program in Visual Basic 2010. This is an HMI (Human-Machine Interface) and therefore has a whole set of buttons that simply send commands to other devices. As a result, there is a huge bunch of event handlers for clicking buttons that actually cannot be divided into modules (unless my understanding of modules is wrong).

Essentially, I would like to be able to move all event handlers, such as button clicks to another file. Could this be done or is it important that they remain in "MainWindow.xaml.vb"? (All my buttons are in one full-screen window, some are hidden by tabs).

Thank,

- Eric T

+5
source share
6 answers

You can use Partial classes to split the class definition into several files that can help organize your code.

The link above will help explain how to use Partial Classes. The following link will show you the syntax of VB.NET (and how to use Class Designer to separate things):

How to split a class into partial classes

+13
source

Of course, use a partial class. Check out this article,

http://visualbasic.about.com/od/usingvbnet/a/partclses.htm

+4
source
+3

, ( ) alt text

, VS, - , #Region #End Region

+3

? " " ?

+1

WPF/SL, , . , .

, . .

+1

All Articles