Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


How can I inherit controls form forms Compact Framework

Posted on 2004-11-18
Medium Priority
Last Modified: 2010-05-18
I am trying to create a multi-form app in c# for my pocket pc. I want to make one form as an template then have other forms inherit controls without having to re-create those controls in memory?
Question by:jbrashears
  • 2

Accepted Solution

weareu earned 500 total points
ID: 12620421
Offcourse this cannot be done... Inhereting from a form, fine... Yes that will work fine, but for each form those controls will be recreated in memory... Remember the .NET framework handles all your pointers and refferences 4 you (unless you are writing unsafe code). Now if the control was a pointer on the child forms it would not be recreated in memory.. But you would have the following problem: when you enter text in one form into a textbox it will change the text of that textbox on all the forms. Luckely this does not happen thanks to the fact that the control is recreated.

If you mean you would like to make your application self smaller on (Pocket PC memory) then yes, go ahead and inherit from a baseform with some controls. This works fine and yes it does save some physical space (not as much as you would think though)...

Expert Comment

ID: 12620448
To inherit controls: do the following:

Create a form with all the controls you would like to inherit lets call it BaseForm...

Next create the form you would like to have the inherited controls and change the following line:
public class Form1 : System.Windows.Forms.Form


public class NewForm : BaseForm

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
The Relationships Diagram is a good way to get an overall view of what a database is keeping track of. It is also where relationships are defined. A relationship specifies how two tables connect to each other. As you build tables in Microsoft Ac…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question