Click here to Skip to main content
15,918,808 members
Home / Discussions / Windows Forms
   

Windows Forms

 
AnswerRe: How to remotely connect multiple PCs(Windows OS based) computers from a single Mac Pin
LongRange.Shooter1-Feb-08 9:52
LongRange.Shooter1-Feb-08 9:52 
QuestionHow to control attribute initialization order for controls? Pin
RichardM110-Jan-08 11:32
RichardM110-Jan-08 11:32 
AnswerRe: How to control attribute initialization order for controls? Pin
Patrick Etc.10-Jan-08 12:23
Patrick Etc.10-Jan-08 12:23 
GeneralRe: How to control attribute initialization order for controls? Pin
RichardM110-Jan-08 12:29
RichardM110-Jan-08 12:29 
GeneralRe: How to control attribute initialization order for controls? Pin
Patrick Etc.10-Jan-08 12:31
Patrick Etc.10-Jan-08 12:31 
GeneralRe: How to control attribute initialization order for controls? Pin
RichardM110-Jan-08 12:48
RichardM110-Jan-08 12:48 
QuestionHow to comunicate between two Windows Forms in BOTH directions???? Pin
szymon7910-Jan-08 8:12
szymon7910-Jan-08 8:12 
GeneralRe: How to comunicate between two Windows Forms in BOTH directions???? Pin
Dave Kreskowiak10-Jan-08 10:36
mveDave Kreskowiak10-Jan-08 10:36 
First, you really need to break the habit of a Form directly modifying another Form. Comming from a C++ world, you should already know about OOP and encapsulation. What you're doing is breaking the rules of encapsulation for sure because a Form (class actually) needs to know about the internals of another class. You're explicitly tying those two classes together to the point where one cannot exist without the other. Does that sound like good encapsulation to you??

Get into the habit of creating a data model first, completely independent of a user interface. I know it's a bit overkill for such a simple example as what you're doing now, but the experience comes in very handy when your projects become larger and larger, and when you need to run the same app as both a Windows Forms app and as a Web Forms app.

For your case, a class that exposes a property that hold the "message" being passed between forms would work just fine. This property would fire an event that either (or both) forms can subscribe to so that if either form, at any time, set the property (call it "Message"), both forms (or even more) would get notified of the change and be able to update their own UI components themselves. Neither form has to know anything about the other.



A guide to posting questions on CodeProject[^]



Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007




GeneralRe: How to comunicate between two Windows Forms in BOTH directions???? Pin
szymon7910-Jan-08 10:57
szymon7910-Jan-08 10:57 
GeneralRe: How to comunicate between two Windows Forms in BOTH directions???? Pin
RichardM110-Jan-08 11:19
RichardM110-Jan-08 11:19 
GeneralRe: How to comunicate between two Windows Forms in BOTH directions???? Pin
szymon7910-Jan-08 11:43
szymon7910-Jan-08 11:43 
GeneralRe: How to comunicate between two Windows Forms in BOTH directions???? Pin
RichardM110-Jan-08 12:13
RichardM110-Jan-08 12:13 
GeneralRe: How to comunicate between two Windows Forms in BOTH directions???? Pin
Luc Pattyn10-Jan-08 12:14
sitebuilderLuc Pattyn10-Jan-08 12:14 
GeneralRe: How to comunicate between two Windows Forms in BOTH directions???? Pin
RichardM110-Jan-08 12:20
RichardM110-Jan-08 12:20 
GeneralRe: How to comunicate between two Windows Forms in BOTH directions???? Pin
Patrick Etc.10-Jan-08 12:25
Patrick Etc.10-Jan-08 12:25 
GeneralRe: How to comunicate between two Windows Forms in BOTH directions???? Pin
Luc Pattyn10-Jan-08 12:56
sitebuilderLuc Pattyn10-Jan-08 12:56 
GeneralRe: How to comunicate between two Windows Forms in BOTH directions???? Pin
Luc Pattyn10-Jan-08 12:55
sitebuilderLuc Pattyn10-Jan-08 12:55 
GeneralRe: How to comunicate between two Windows Forms in BOTH directions???? Pin
RichardM110-Jan-08 13:08
RichardM110-Jan-08 13:08 
GeneralRe: How to comunicate between two Windows Forms in BOTH directions???? Pin
Luc Pattyn10-Jan-08 13:13
sitebuilderLuc Pattyn10-Jan-08 13:13 
GeneralRe: How to comunicate between two Windows Forms in BOTH directions???? Pin
RichardM110-Jan-08 13:30
RichardM110-Jan-08 13:30 
Generalscholar & gentleman Pin
Luc Pattyn10-Jan-08 13:43
sitebuilderLuc Pattyn10-Jan-08 13:43 
GeneralRe: How to comunicate between two Windows Forms in BOTH directions???? Pin
Dave Kreskowiak10-Jan-08 13:11
mveDave Kreskowiak10-Jan-08 13:11 
QuestionEnding C# app gracefully on shutdown Pin
Clutchplate10-Jan-08 7:44
Clutchplate10-Jan-08 7:44 
GeneralRe: Ending C# app gracefully on shutdown Pin
Luc Pattyn10-Jan-08 8:22
sitebuilderLuc Pattyn10-Jan-08 8:22 
GeneralRe: Ending C# app gracefully on shutdown Pin
Clutchplate11-Jan-08 5:49
Clutchplate11-Jan-08 5:49 

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.