Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can a Visual Basic (.NET / 2010) file be split up for readability?

I'm writing a program in Visual Basic 2010. It's a HMI (Human-Machine Interface) and therefore has a whole whack of buttons that just send commands to other devices. As a result, there are a huge pile of event handlers for clicking buttons that can't really be broken down into modules (unless my understanding of modules is wrong).

Essentially, I'd like to be able to move all the event handlers, for, say, button presses to a different file. Can this be done or is it important that they stay in "MainWindow.xaml.vb"? (All my buttons reside in one fullscreen window, some are hidden by tabs).

Thanks,

--Erik T

like image 454
evilspoons Avatar asked Oct 29 '10 16:10

evilspoons


3 Answers

You can use Partial Classes to break up your class definition into multiple files which might help organize your code.

The link above will help explain exactly how to use Partial Classes. The following link will show you the VB.NET Syntax (and how to use Class Designer to split things up):

How to: Split a Class into Partial Classes

like image 137
Justin Niessner Avatar answered Oct 20 '22 22:10

Justin Niessner


Sure use partial class. Check this article,

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

like image 28
A_Nabelsi Avatar answered Oct 20 '22 22:10

A_Nabelsi


You can use Partial Classes to split these into separate files, if required.

like image 3
Reed Copsey Avatar answered Oct 20 '22 21:10

Reed Copsey