469,071 Members | 2,003 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,071 developers. It's quick & easy.

Question re Visual Inheritance in VS 2005

Hi,

I am thinking of using visual inheritance. I am using C# VS 2005. I
am concerned about how good it is. I have heard about problems like
controls dissapearing or so.

Any hints, tips, ideas, concerns ???

Thank you,
_dino_
Jan 25 '06 #1
3 1210
I have not tried Visual Inheritance in VS.NET 2005, mostly because it was
such a pain in the butt in VS.NET 2003. It worked, of course, but I can
personally attest that what you report is true.

Let us know what you find out.

Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Dino Buljubasic" wrote:
Hi,

I am thinking of using visual inheritance. I am using C# VS 2005. I
am concerned about how good it is. I have heard about problems like
controls dissapearing or so.

Any hints, tips, ideas, concerns ???

Thank you,
_dino_

Jan 25 '06 #2
Hi Dino,
I have done this in VS2005 and found I could do everything I wanted except
for inheriting from a generic form i.e.

class MyForm<T> : Form
{
....
}

which causes the derived form to not be able to be rendered in design view,
it works fine at runtime, but not much use unless you intend to create your
form blind. Apparently this is a known issue and not one that MSFT plan to
fix soon.

Mark

"Dino Buljubasic" wrote:
Hi,

I am thinking of using visual inheritance. I am using C# VS 2005. I
am concerned about how good it is. I have heard about problems like
controls dissapearing or so.

Any hints, tips, ideas, concerns ???

Thank you,
_dino_

Jan 26 '06 #3
Hi Peter,

Here is what I got from Markus Groenendijk on this topic. Maybe you
find it useful. I have decided to proceed without visual inheritance.
>
Hi Dino,

We use VI on forms extensively in VS 2003.
I'd definitely recommend using it. Dunno about problems in VS 2005
(seems OK so far) but in VS 2003 AFAIKS there's one problem which
might
cause problems when you're loading an inherited form.
To avoid this problem make sure you

1) use Me.DesignMode as appropriate.

Your client code in event handlers or overrides should
probably not be executed during design mode.

2) Use overrides rather than the event handlers.

So for ex. in VB I'd use:

Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)

rather than

Private Sub ManagedForm_Load(...) Handles MyBase.Load

3) Make handlers overridable so you can override them in derived
forms. For
ex:

Private Sub btnOk_Click(...) Handles btnOk.Click
OnOkClick()
End Sub

Protected Overridable Sub OnOkClick()
End Sub
4) Oh, and of course, use a version control system or have backups
handy ;-)

HTH & Regards,
Marius.
On Wed, 25 Jan 2006 12:50:03 -0800, "Peter Bromberg [C# MVP]"
<pb*******@yahoo.nospammin.com> wrote:
I have not tried Visual Inheritance in VS.NET 2005, mostly because it was
such a pain in the butt in VS.NET 2003. It worked, of course, but I can
personally attest that what you report is true.

Let us know what you find out.

Peter


Jan 27 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by aap | last post: by
5 posts views Thread by Billy Cormic | last post: by
1 post views Thread by Martin Horn | last post: by
4 posts views Thread by MikeB | last post: by
7 posts views Thread by jason | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.