473,387 Members | 1,590 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,387 software developers and data experts.

Abstract classes and the Forms Designer

Hi everyone,

I would like to create a base class which inherits from
System.Windows.Forms.Form and contains several pure-virtual
("MustOverride") functions. For example:
Public MustInherit Class MyInterfaceForm
Inherits System.Windows.Forms.Form

[ forms designed code omitted ]

Public MustOverride Function MyFunction() As Boolean
End Class
Public Class MyForm
Inherits MyInterfaceForm

[ forms designer code omitted ]

Public Overrides Function MyFunction() As Boolean
Return True
End Function
End Class
The above code compiles fine, but the forms designer chokes
on it -- so I can't design the inherited form!

Any ideas?

My current ugly hack is this:
Public Interface IMyInterface
Function MyFunction() As Boolean
Function Form() As System.Windows.Forms.Form
End Interface
Public Class MyForm
Inherits System.Windows.Forms.Form
Implements IMyInterface

[ forms designer code omitted ]

Public Function MyFunction() As Boolean _
Implements IMyInterface.MyFunction

Return True
End Function

Public Function Form() As Form _
Implements IMyInterface.Form

Return Me
End Function
End Class
With this, I can store an object reference of type
IMyInterface... but if I want to manipulate it as a Form,
then I have to make a function call to get that interface.

If anyone knows of a cleaner solution, please let me know.
Thanks.

-- graham
Nov 21 '05 #1
0 912

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: J.Marsch | last post by:
I am trying to create a base form that all of our application's forms will inherit from. I would like to mark it "abstract", but if I do, I get an error from the form designer when I try to design...
2
by: Joe Vrba | last post by:
I'm building a family of components derived from UserControl. There's an abstract base class to ensure basic functionality and then numerous other controls derived from that. The problem is...
1
by: Dave Veeneman | last post by:
I'm creating several forms that inherit from a base form. I want to require the derived forms to implement certain methods of the base form. The easy solution would be to declare abstract methods...
7
by: erin.sebastian | last post by:
Hello Everyone, This is my first attempt at coding using an abstract class and i am getting an error i can't figure out. Here is the back ground. I have a project that contains an abstract...
1
by: Murray Gill | last post by:
Our current solution has a number of ASP.NET pages with very similar functionality. We would like to move the common functions into a base class that inherits from System.Web.UI.Page, and then force...
8
by: diatom | last post by:
Is it possible to create a windows form as an abstract class? Let me explain ... I am writing a windows applciation where I will need around 100 dialogs - each with a similar look, feel, and...
7
by: jason | last post by:
In the microsoft starter kit Time Tracker application, the data access layer code consist of three cs files. DataAccessHelper.cs DataAcess.cs SQLDataAccessLayer.cs DataAcccessHelper appears...
2
by: Joh Smith | last post by:
I have a form called Parent that I mark as abstract (MustInherit). Then I add another form called Child that inherits Parent and implements all Parent abstract methods. It compiles Ok, but when i...
2
by: parez | last post by:
how do i put an abstract property ( or something that lets me know that derived class has not implemented that particular property ) in base form in my win forms project? if i make the base form...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.