Click here to Skip to main content
15,905,508 members
Home / Discussions / C#
   

C#

 
AnswerRe: Clone Windows Forms Information Pin
Peace ON8-Jun-10 20:44
Peace ON8-Jun-10 20:44 
QuestionWindows application create an Excel file Pin
Member 44642398-Jun-10 11:45
Member 44642398-Jun-10 11:45 
AnswerRe: Windows application create an Excel file Pin
Dan Mos8-Jun-10 11:59
Dan Mos8-Jun-10 11:59 
AnswerRe: Windows application create an Excel file Pin
Ramkithepower9-Jun-10 4:01
Ramkithepower9-Jun-10 4:01 
Questionwindows application Pin
jashimu8-Jun-10 8:36
jashimu8-Jun-10 8:36 
AnswerRe: windows application Pin
Manas Bhardwaj8-Jun-10 9:08
professionalManas Bhardwaj8-Jun-10 9:08 
AnswerRe: windows application [modified] Pin
#realJSOP8-Jun-10 10:04
professional#realJSOP8-Jun-10 10:04 
AnswerRe: windows application Pin
LookSharp9-Jun-10 3:54
LookSharp9-Jun-10 3:54 
Similar to John Simmons's answer, but let each form's constructor take a ClassA. Now, create the ClassA before creating either form, and pass it to the form before showing it. The important fact is that neither form 'owns' (or instantiates) the shared instance of ClassA, rather, some larger scope owns it and makes it available to both forms that want to use it.

An alternative to passing the ClassA into the constructor is to make a ClassA property on each form, and assign the property before showing the form. This is a very common pattern when presenting dialogs whose purpose is to modify data that is used elsewhere. Here's a snippet:
public void DoFormStuff(ClassA ca)
    {
    using (MyForm frm = new MyForm())
        {
        frm.ClassA = ca;
        frm.ShowDialog(this);
        }
    }

GeneralRe: windows application Pin
jashimu9-Jun-10 7:56
jashimu9-Jun-10 7:56 
QuestionLINQ DataContext and IDisposable Pin
Member 39190498-Jun-10 7:01
Member 39190498-Jun-10 7:01 
AnswerRe: LINQ DataContext and IDisposable Pin
Pete O'Hanlon8-Jun-10 10:01
mvePete O'Hanlon8-Jun-10 10:01 
QuestionIndexer Question Pin
David Knechtges8-Jun-10 5:54
David Knechtges8-Jun-10 5:54 
AnswerRe: Indexer Question Pin
harold aptroot8-Jun-10 6:10
harold aptroot8-Jun-10 6:10 
AnswerRe: Indexer Question Pin
T M Gray8-Jun-10 10:45
T M Gray8-Jun-10 10:45 
GeneralRe: Indexer Question Pin
harold aptroot8-Jun-10 10:56
harold aptroot8-Jun-10 10:56 
AnswerRe: Indexer Question Pin
LookSharp8-Jun-10 17:15
LookSharp8-Jun-10 17:15 
Questionmaking a text box more efficient Pin
codie30078-Jun-10 5:43
codie30078-Jun-10 5:43 
AnswerRe: making a text box more efficient Pin
Dave Kreskowiak8-Jun-10 6:23
mveDave Kreskowiak8-Jun-10 6:23 
GeneralRe: making a text box more efficient Pin
AspDotNetDev8-Jun-10 9:21
protectorAspDotNetDev8-Jun-10 9:21 
GeneralRe: making a text box more efficient Pin
Dave Kreskowiak8-Jun-10 10:12
mveDave Kreskowiak8-Jun-10 10:12 
GeneralRe: making a text box more efficient Pin
Pete O'Hanlon8-Jun-10 10:42
mvePete O'Hanlon8-Jun-10 10:42 
GeneralRe: making a text box more efficient Pin
Dave Kreskowiak8-Jun-10 12:09
mveDave Kreskowiak8-Jun-10 12:09 
GeneralRe: making a text box more efficient Pin
AspDotNetDev8-Jun-10 10:47
protectorAspDotNetDev8-Jun-10 10:47 
GeneralRe: making a text box more efficient Pin
Luc Pattyn8-Jun-10 11:03
sitebuilderLuc Pattyn8-Jun-10 11:03 
GeneralRe: making a text box more efficient Pin
AspDotNetDev8-Jun-10 12:45
protectorAspDotNetDev8-Jun-10 12:45 

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.