Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
How do I do partial classes? I've got a form which has a body of code which is logically a separate block, and I'd like to be able to view that block by itself. So I decided to put it into a partial class. This works OK, except that if I have it in the same module as the form, the form's designer won't show. If I have it in a separate module the form's designer will show but if I double click on that module vb creates an extra designer (a basic form) and inserts initialization code in my module for it. And then I can't open the designer for the form again. Hmm.
Posted (edited)
How do I do partial classes? I've got a form which has a body of code which is logically a separate block' date=' and I'd like to be able to view that block by itself. So I decided to put it into a partial class. This works OK, except that if I have it in the same module as the form, the form's designer won't show. If I have it in a separate module the form's designer will show but if I double click on that module vb creates an extra designer (a basic form) and inserts initialization code in my module for it. And then I can't open the designer for the form again. Hmm.[/quote']

 

The main purpose of partial classes is to provide a way of having both auto-generated and manually written code in one class. Therefore its a merely a workaround for tools (in our case - for Visual Studio) and developers should avoid using partical classes for organizing their source code. If you feel that some part of code does not belong here and logically should be separated from the "main" class - consider making a new class from it.

 

Unfortunately forms designer is not the best part (not to say more :cool: ) of visual studio and so far as I remember it never was :(

Edited by Igor Sukhov
Posted
The main purpose of partial classes is to provide a way of having both auto-generated and manually written code in one class. Therefore its a merely a workaround for tools (in our case - for Visual Studio) and developers should avoid using partical classes for organizing their source code. If you feel that some part of code does not belong here and logically should be separated from the "main" class - consider making a new class from it.

 

Unfortunately forms designer is not the best part (not to say more :cool: ) of visual studio and so far as I remember it never was :(

OK, thanks. The code is more of a subsection of the form's code than something logically separate, so I was hoping just to be able to display it by itself so that I could review it without being distracted by the other code of the form. But I could think of a way to move it out, so I guess that's what I should do.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...