Click here to Skip to main content
15,890,825 members
Home / Discussions / C#
   

C#

 
AnswerRe: install image with setup file Pin
Jimmanuel22-May-08 1:28
Jimmanuel22-May-08 1:28 
AnswerRe: install image with setup file Pin
Peter Josefsson Sweden22-May-08 11:46
Peter Josefsson Sweden22-May-08 11:46 
QuestionHow to parse a string to display in List View? Pin
daden20321-May-08 21:52
daden20321-May-08 21:52 
QuestionGeneral design guidelines/principles Pin
Nick K21-May-08 21:10
Nick K21-May-08 21:10 
AnswerRe: General design guidelines/principles Pin
Guffa22-May-08 0:23
Guffa22-May-08 0:23 
AnswerRe: General design guidelines/principles Pin
Robert.C.Cartaino22-May-08 3:46
Robert.C.Cartaino22-May-08 3:46 
GeneralRe: General design guidelines/principles Pin
Nick K22-May-08 23:50
Nick K22-May-08 23:50 
AnswerRe: General design guidelines/principles Pin
Mike Dimmick22-May-08 4:07
Mike Dimmick22-May-08 4:07 
In my opinion, and a lot of others, code reuse is a real myth. You virtually never pick up a collection of objects wholesale and put them in a different project or product with no modifications because each project's requirements are different.

I tend to stick to modularization with information-hiding for most objects. I only bother with inheritance when I have a real need for virtual functions, for example the GoF 'Strategy' pattern. Instead of defining one structure with a type-discrimination enumeration in, I'll write a base class (typically abstract) and one derived class per different implementation. If for some reason the classes already exist for information sharing/hiding reasons or just because that's what the Framework requires (e.g. a Form), I'll use an interface instead of a base class, but here you can't have a common base implementation, you have to actually implement the interface.

If you're writing an application that has a lot of forms and you want them all to look similar - have certain controls in common that will always perform the same function (called visual inheritance) - you can make your own class that derives from Form and derive your forms from that (you have to edit the code to do this in Visual Studio, but once you do the designer can cope as long as the base form compiles correctly). I'm currently working on a project where the inheritance hierarchy goes:
System.Windows.Forms.Form
  Company.ScreenManager.FormBase
    Application.AppForm
      Application.AppLogoForm
        actual forms
FormBase adds a few virtual functions called by our 'screen manager', AppForm adds some base behaviours specific to this application, and AppLogoForm adds a logo to the form (some forms don't have the logo, but most are branded). This is a full-screen Compact Framework application; if it were necessary to have different contents on the desktop I'd have one Form containing a different UserControl for the different modes, with the control being swapped over when you switch modes.


DoEvents: Generating unexpected recursion since 1991

QuestionHow to Create Custom Skin and apply Pin
Sababathi Balakrishnan21-May-08 20:53
Sababathi Balakrishnan21-May-08 20:53 
AnswerRe: How to Create Custom Skin and apply Pin
Laddie21-May-08 20:57
Laddie21-May-08 20:57 
QuestionModulus function Pin
usyra4221-May-08 20:43
usyra4221-May-08 20:43 
AnswerRe: Modulus function Pin
laserbaronen21-May-08 20:48
laserbaronen21-May-08 20:48 
AnswerRe: Modulus function Pin
Shree22-May-08 0:18
Shree22-May-08 0:18 
AnswerRe: Modulus function Pin
Peter Josefsson Sweden22-May-08 9:49
Peter Josefsson Sweden22-May-08 9:49 
Questionhow to write a property at designer by propety window at design time of nested control Pin
Guru Call21-May-08 20:12
Guru Call21-May-08 20:12 
AnswerRe: how to write a property at designer by propety window at design time of nested control Pin
gnjunge21-May-08 21:37
gnjunge21-May-08 21:37 
QuestionPassing value from popup to parent page Pin
Abu-Muawiyah21-May-08 19:59
Abu-Muawiyah21-May-08 19:59 
AnswerRe: Passing value from popup to parent page Pin
Vikram A Punathambekar21-May-08 20:28
Vikram A Punathambekar21-May-08 20:28 
Questionhow to set an image for tabpage's button Pin
Sababathi Balakrishnan21-May-08 19:44
Sababathi Balakrishnan21-May-08 19:44 
AnswerRe: how to set an image for tabpage's button Pin
dan!sh 21-May-08 20:12
professional dan!sh 21-May-08 20:12 
Answer[Message Deleted] Pin
Laddie21-May-08 20:29
Laddie21-May-08 20:29 
GeneralRe: how to set an image for tabpage's button Pin
dan!sh 21-May-08 20:38
professional dan!sh 21-May-08 20:38 
AnswerRe: how to set an image for tabpage's button Pin
Sababathi Balakrishnan21-May-08 20:46
Sababathi Balakrishnan21-May-08 20:46 
QuestionReg:Image Conversion Pin
Member 384581521-May-08 19:35
Member 384581521-May-08 19:35 
AnswerRe: Reg:Image Conversion Pin
Sababathi Balakrishnan21-May-08 21:12
Sababathi Balakrishnan21-May-08 21:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.