Click here to Skip to main content
15,885,216 members
Home / Discussions / C#
   

C#

 
GeneralRe: I am coding in C# on Webform, who can show me the way to send SMS from Webform? thanks! Pin
Christian Graus22-Oct-09 17:09
protectorChristian Graus22-Oct-09 17:09 
GeneralRe: I am coding in C# on Webform, who can show me the way to send SMS from Webform? thanks! Pin
benjymous22-Oct-09 22:28
benjymous22-Oct-09 22:28 
Questionchange win form name Pin
jashimu22-Oct-09 9:53
jashimu22-Oct-09 9:53 
AnswerRe: change win form name Pin
DaveyM6922-Oct-09 10:15
professionalDaveyM6922-Oct-09 10:15 
GeneralRe: change win form name Pin
jashimu22-Oct-09 10:29
jashimu22-Oct-09 10:29 
GeneralRe: change win form name Pin
EliottA22-Oct-09 11:10
EliottA22-Oct-09 11:10 
Questionhow to make a form reference public? Pin
genisyssoftware22-Oct-09 8:47
genisyssoftware22-Oct-09 8:47 
AnswerRe: how to make a form reference public? [modified] PinPopular
DaveyM6922-Oct-09 8:58
professionalDaveyM6922-Oct-09 8:58 
First of all, there is no need for the ref for your parameter. Form is a class and therefore passed by reference anyway.

Secondly, passing Forms around and making instances of them public to external classes is a BAD idea.

Ask yourself - what object owns what?

1. If the Form is owned by the other object, then when it creates the form it can store a reference to it for later use.
2. If the Form owns the other object , then the other object should raise events which the Form subscribes to after instanciation of the object.
3. If there is no direct relationship between the Form and the other object then I would recommend a 'manager' class that can instanciate the form and the other object, store references to them and subscribe to their events so it can handle communication between them.

Edit: A little diagram to show what I mean:
One and Two:

                  |---------------------------------------------------------------|
Parent            V                       Child                                   |
===================================       ===================================     |
|-----------Subscriptions---------|       |-----------Subscriptions---------|     |
|Properties ============= Events  |   |-->|Properties ============= Events  | >---|
|-----------|  OBJECT   |---------|   |   |-----------|  OBJECT   |---------|
|Methods    ============= Call/Set| --|-->|Methods    ============= Call/Set|
===================================       ===================================


Three:

                                            |--------------------------------------------|
                          Manager           V                                            |
                          ===================================                            |
                          |-----------Subscriptions---------|                            |
                          |Properties ============= Events  |                            |
                          |-----------|  OBJECT   |---------|                            |
                          |Methods    ============= Call/Set| >---|                      |
                          ===================================     |                      |
|---------------------------------------------|-------------------|                      |
|                                             |                                          |
|                                             |                                          |
|   ===================================       |   ===================================    |
|   |-----------Subscriptions---------|       |   |-----------Subscriptions---------|    |
|-->|Properties ============= Events  | >--|  |-->|Properties ============= Events  | >--|
|   |-----------|  OBJECT   |---------|    |  |   |-----------|  OBJECT   |---------|    |
|-->|Methods    ============= Call/Set|    |  |-->|Methods    ============= Call/Set|    |
    ===================================    |      ===================================    |
                                           |---------------------------------------------|


Dave

Generic BackgroundWorker - My latest article!
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Why are you using VB6? Do you hate yourself? (Christian Graus)

modified on Thursday, October 22, 2009 3:24 PM

GeneralRe: how to make a form reference public? Pin
Christian Graus22-Oct-09 17:35
protectorChristian Graus22-Oct-09 17:35 
GeneralRe: how to make a form reference public? Pin
dan!sh 22-Oct-09 17:45
professional dan!sh 22-Oct-09 17:45 
QuestionHow to drag image from my picturebox to other application(ex.Photoshop) Pin
Kortez222322-Oct-09 7:57
Kortez222322-Oct-09 7:57 
AnswerRe: How to drag image from my picturebox to other application(ex.Photoshop) Pin
Christian Graus22-Oct-09 12:10
protectorChristian Graus22-Oct-09 12:10 
QuestionMouseMove event firing even though I'm not moving my mouse! Pin
WebMaster22-Oct-09 7:51
WebMaster22-Oct-09 7:51 
AnswerRe: MouseMove event firing even though I'm not moving my mouse! Pin
Eddy Vluggen22-Oct-09 8:29
professionalEddy Vluggen22-Oct-09 8:29 
GeneralRe: MouseMove event firing even though I'm not moving my mouse! Pin
WebMaster22-Oct-09 8:43
WebMaster22-Oct-09 8:43 
QuestionCAPICOM Process replacement Pin
Dave Kreskowiak22-Oct-09 7:49
mveDave Kreskowiak22-Oct-09 7:49 
Answer[SOLVED - Sort of...] CAPICOM Process replacement Pin
Dave Kreskowiak22-Oct-09 10:25
mveDave Kreskowiak22-Oct-09 10:25 
QuestionHow to copy a file? Pin
masoudshao22-Oct-09 7:22
masoudshao22-Oct-09 7:22 
AnswerRe: How to copy a file? Pin
Abhijit Jana22-Oct-09 7:31
professionalAbhijit Jana22-Oct-09 7:31 
GeneralRe: How to copy a file? Pin
Ashfield22-Oct-09 9:31
Ashfield22-Oct-09 9:31 
GeneralRe: How to copy a file? Pin
Abhijit Jana22-Oct-09 10:03
professionalAbhijit Jana22-Oct-09 10:03 
AnswerRe: How to copy a file? Pin
Abhishek Sur22-Oct-09 7:48
professionalAbhishek Sur22-Oct-09 7:48 
QuestionWhen to override Equals() ? Pin
Wes Jones22-Oct-09 6:20
Wes Jones22-Oct-09 6:20 
AnswerRe: When to override Equals() ? Pin
Henry Minute22-Oct-09 6:41
Henry Minute22-Oct-09 6:41 
AnswerRe: When to override Equals() ? Pin
DaveyM6922-Oct-09 6:47
professionalDaveyM6922-Oct-09 6:47 

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.