Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Making visual classes in .NET
Message
De
15/07/2011 13:12:34
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2008
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01518209
Message ID:
01518265
Vues:
72
>Dear Geek Goddess,
>
>That's really the only way to do it? Clone and modify? I am not disputing what you say, was just expecting more inheritance than that.


I didn't say it was the only way, I said it was the easiest way. <g> You *can* also Add New Item, then instead of choosing WindowsForm, you choose Inherited Form instead and then pick MyBaseForm. But why bother with those extra steps? It really is easier to just change it like I mentioned.

There's no cloning going on here, so I'm not sure what you mean by that. TestForm is inheriting from MyBaseForm, so there's your inheritance.

~~Bonnie



>>>In vfp, w can make visual classes in vfp including form classes. Anybody knows how to do form classes in visual way with .NET?
>>
>>Hi Luis,
>>
>>All you have to do is create a Form as you usually would. When you need to sub-class from that Form, the easiest thing to do is just create another form, and change the class in code.
>>
>>So when you add a new Form, the class gets generated like this:
>>
>>
>>public partial class TestForm : Form
>>{
>>    public TestForm()
>>    {
>>        InitializeComponent();
>>    }
>>}
>>
>>
>>Replace the System Form with yours:
>>
>>
>>public partial class TestForm : MyBaseForm
>>{
>>    public TestForm()
>>    {
>>        InitializeComponent();
>>    }
>>}
>>
>>
>>Also, take a look at my blog post for sub-classing other controls (such as TextBox, ComboBox, etc.):
>>
>>http://geek-goddess-bonnie.blogspot.com/2009/10/why-and-how-to-sub-class-base-classes.html
>>
>>~~Bonnie
>
>Dear Geek Goddess,
>
>That's really the only way to do it? Clone and modify? I am not disputing what you say, was just expecting more inheritance than that.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform