473,383 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Inherit from a Windows Form

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
2 1334
"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
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: afatdog | last post by:
Form1: //----------------------------------------------------------------- public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.TextBox textBox1; private...
0
by: afatdog | last post by:
Form1: //----------------------------------------------------------------- public class Form1 : System.Windows.Forms.Form { private System.Windows.Forms.TextBox textBox1; private...
6
by: Mohammad-Reza | last post by:
I wrote a component using class library wizard. In my component i want to in order to RightToLeft property do some works. I can find out if user set this property to Yes or No, But if He/She set it...
5
by: Mike L | last post by:
This is my first attempt at inheriting a class. I want to inherit textbox class to my derived class ClassNum. ClassNum will override the TextChanged, Leave, KeyPress and Enter methods. So,...
1
by: Wu Qinliang | last post by:
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: ...
2
by: harvie wang | last post by:
Hi, I want to implement a common Form with special interface, such as MovePoint(double,double). I create a interface first: namespace ABC.Test { public Interface IMyWindowInterface { void...
3
by: justsome_newbie | last post by:
Sorry for posting another question, but I can't seem to get the hang of ASP.Net. In windows apps if I want to extend a control I would just create a class that inherits from that control and do...
1
by: Ronald S. Cook | last post by:
I have many forms in my Windows project. When I go to create an inherited form, I see all my forms in the list of choices. HOWEVER, if any form is marked as must inherit, then it doesn't show up...
2
by: Manekurt | last post by:
Hello Everyone. Does anyone knows how to create a new property for an user control that inherits a list view? The property should be a boolean value set to each clumn that is created in the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.