By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,919 Members | 1,600 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,919 IT Pros & Developers. It's quick & easy.

Inherit from a Windows Form

P: n/a
I created a Windows form named myform1, and put some controls on it. I need
another form named myform2. Because myform2 is similar to myform1, so I want
myform2 to inherit from myform1, i.e:

Public Class myform2
inherits myform1
.......

End Class

However the code above can't work. myform2 even can't be displayed in IDE.
I am appreciated for any help.

Wu Qinliang

Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Wu Qinliang" <wu********@hotmail.com> schrieb:
I created a Windows form named myform1, and put some controls on it. I need
another form named myform2. Because myform2 is similar to myform1, so I
want
myform2 to inherit from myform1, i.e:

Public Class myform2
inherits myform1
......

End Class

However the code above can't work. myform2 even can't be displayed in IDE.


Choose "Project" -> "Add inherited form..." from VS.NET's menu. Then select
the form to inherit from and add your code to the inherited form.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2

P: n/a
"Wu Qinliang" <wu********@hotmail.com> wrote in message
news:OR**************@TK2MSFTNGP12.phx.gbl...
Because myform2 is similar to myform1, so I want myform2 to
inherit from myform1, i.e: .. . . However the code above can't work. myform2 even can't be
displayed in IDE.


And what error do you get when you try to open it in the Designer?

Have you marked either the class myform1 or any of its methods as
"MustInherit"? The Designer can't cope with "abstract" forms.

HTH,
Phill W.
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.