Sharat Chandra
Sharat Chandra

Reputation: 4544

Placing code for different controls in a Windows form (VB.NET) in separate classes and separate files

I have a Windows Form application with different buttons, textboxes and Tab controls.

The source code gets automatically generated in the Form class (in a suingle file) upon double-clicking on the button/tab/textbox.

How can I make the code to get automatically generated in separate classes and separate files upon double-clickon on the controls ?

Upvotes: 0

Views: 365

Answers (3)

andy
andy

Reputation: 6079

Automatically its not possible................

you can do it with the Partial Class........... you need to move manually all the control events to another Partial class of same file :)

Upvotes: 1

Ken White
Ken White

Reputation: 125687

Yuo can't, and I'm not sure why you think it belongs in separate classes and files in the first place.

If you drop controls on the form at design time, they become properties (members) of the form class. You're not writing new button classes, textbox classes, and tab control classes - you're accessing members of the form's class. There's no way the IDE will put them in separate code units.

Upvotes: 1

coolmine
coolmine

Reputation: 4463

It's not possible. Also when double clicking a control it doesn't only generate code in the class but in the form Designer.cs as well which automatically links all the events to the generated code.

Upvotes: 1

Related Questions