Click here to Skip to main content
15,881,281 members
Home / Discussions / C#
   

C#

 
GeneralRe: Accessing mdiParent form menu from mdiChild form via code Pin
AussieLew14-Jul-10 22:09
AussieLew14-Jul-10 22:09 
AnswerRe: Accessing mdiParent form menu from mdiChild form via code Pin
Peace ON14-Jul-10 22:49
Peace ON14-Jul-10 22:49 
GeneralRe: Accessing mdiParent form menu from mdiChild form via code Pin
Dave Kreskowiak15-Jul-10 2:02
mveDave Kreskowiak15-Jul-10 2:02 
AnswerRe: Accessing mdiParent form menu from mdiChild form via code [modified] Pin
DaveyM6914-Jul-10 23:54
professionalDaveyM6914-Jul-10 23:54 
GeneralRe: Accessing mdiParent form menu from mdiChild form via code Pin
AussieLew15-Jul-10 23:11
AussieLew15-Jul-10 23:11 
GeneralRe: Accessing mdiParent form menu from mdiChild form via code Pin
DaveyM6917-Jul-10 0:35
professionalDaveyM6917-Jul-10 0:35 
GeneralRe: Accessing mdiParent form menu from mdiChild form via code Pin
AussieLew27-Jul-10 13:08
AussieLew27-Jul-10 13:08 
GeneralRe: Accessing mdiParent form menu from mdiChild form via code Pin
DaveyM6930-Jul-10 10:47
professionalDaveyM6930-Jul-10 10:47 
Glad it's helped Big Grin | :-D

Good questions. Static variables/properties are almost never the correct way to go, that normally indicates a bad design. There are 3 methods that can be used. In order of easiest to most complex but also worst to best (as is often the case in programming!)


  1. Easiest but normally worst

    Static properties/variables as you mentioned. If using this, as they will need to be either internal or public I would strongly suggest properties with a private backing field.
  2. Next best

    A singleton class instance. See here[^] for a good tutorial by one of the C# gods.
  3. Normally the best, but can be complex to implement depending on class hierachys

    Let the parent form decide if the delete should be allowed and perform it. The children simply request the action and pass any required data via an event.

Not everyone would agree, and the 2nd method is very commonly used in production code as it gives better separation than the 3rd which is good OOP practice and therefore often the better solution.
Dave

If this helped, please vote & accept answer!


Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)

BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)

GeneralRe: Accessing mdiParent form menu from mdiChild form via code Pin
AussieLew30-Jul-10 22:51
AussieLew30-Jul-10 22:51 
GeneralRe: Accessing mdiParent form menu from mdiChild form via code Pin
DaveyM6931-Jul-10 0:13
professionalDaveyM6931-Jul-10 0:13 
QuestionList.Sort() Stability? Reliability...? Pin
ely_bob14-Jul-10 14:41
professionalely_bob14-Jul-10 14:41 
AnswerRe: List.Sort() Stability? Reliability...? Pin
Luc Pattyn14-Jul-10 15:17
sitebuilderLuc Pattyn14-Jul-10 15:17 
GeneralRe: List.Sort() Stability? Reliability...? Pin
Ennis Ray Lynch, Jr.15-Jul-10 3:22
Ennis Ray Lynch, Jr.15-Jul-10 3:22 
GeneralRe: List.Sort() Stability? Reliability...? Pin
Richard Blythe15-Jul-10 6:37
Richard Blythe15-Jul-10 6:37 
GeneralRe: List.Sort() Stability? Reliability...? Pin
Richard Blythe15-Jul-10 6:39
Richard Blythe15-Jul-10 6:39 
AnswerRe: List.Sort() Stability? Reliability...? Pin
Luc Pattyn15-Jul-10 7:15
sitebuilderLuc Pattyn15-Jul-10 7:15 
AnswerRe: List.Sort() Stability? Reliability...? Pin
Pete O'Hanlon15-Jul-10 10:37
mvePete O'Hanlon15-Jul-10 10:37 
QuestionHow do I format Column when a Gridview loads? Pin
roman_s14-Jul-10 9:14
roman_s14-Jul-10 9:14 
AnswerRe: How do I format Column when a Gridview loads? Pin
Luc Pattyn14-Jul-10 9:35
sitebuilderLuc Pattyn14-Jul-10 9:35 
GeneralRe: How do I format Column when a Gridview loads? Pin
roman_s14-Jul-10 10:06
roman_s14-Jul-10 10:06 
GeneralRe: How do I format Column when a Gridview loads? Pin
Luc Pattyn14-Jul-10 10:18
sitebuilderLuc Pattyn14-Jul-10 10:18 
GeneralRe: How do I format Column when a Gridview loads? Pin
roman_s14-Jul-10 10:31
roman_s14-Jul-10 10:31 
AnswerRe: How do I format Column when a Gridview loads? Pin
T M Gray14-Jul-10 10:17
T M Gray14-Jul-10 10:17 
GeneralRe: How do I format Column when a Gridview loads? Pin
Luc Pattyn14-Jul-10 10:21
sitebuilderLuc Pattyn14-Jul-10 10:21 
GeneralRe: How do I format Column when a Gridview loads? Pin
T M Gray14-Jul-10 10:37
T M Gray14-Jul-10 10:37 

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.