Click here to Skip to main content
16,014,816 members
Home / Discussions / C#
   

C#

 
GeneralRe: TreeView Expansion Question Pin
Sabran23-Apr-02 10:51
Sabran23-Apr-02 10:51 
GeneralRe: TreeView Expansion Question Pin
Neil Van Note23-Apr-02 17:43
Neil Van Note23-Apr-02 17:43 
GeneralRe: TreeView Expansion Question Pin
Sabran27-Apr-02 0:18
Sabran27-Apr-02 0:18 
GeneralRe: TreeView Expansion Question Pin
Neil Van Note27-Apr-02 8:42
Neil Van Note27-Apr-02 8:42 
QuestionControls across forms? Pin
Brian Olej23-Apr-02 7:19
Brian Olej23-Apr-02 7:19 
AnswerRe: Controls across forms? Pin
James T. Johnson23-Apr-02 8:31
James T. Johnson23-Apr-02 8:31 
GeneralRe: Controls across forms? Pin
Brian Olej23-Apr-02 9:27
Brian Olej23-Apr-02 9:27 
GeneralRe: Controls across forms? Pin
James T. Johnson24-Apr-02 2:10
James T. Johnson24-Apr-02 2:10 
Heres the names I will use.

Classes
  • ParentForm - The MDI Parent
  • ChildFormA - One of the child forms
  • ChildFormB - Another child form
  • ChildFormC - The last child form
  • DataA - Data class for ChildFormA
  • DataB - Data class for ChildFormB
  • DataC - Data class for ChildFormC
Class instances stored in ParentForm class
  • childA - ChildFormA
  • childB - ChildFormB
  • childC - ChildFormC
Now a little setup Smile | :)

In ParentForm

public void SendToChildA(DataA data)
{
  childA.Data = data;
  childA.DataSent();
}
Do similar for the other children (B and C)

Now in each of the ChildForms create a Data property which is of the same type as the class associated with it. Also create a method called DataSent which will actually do the processing of the data for the child form.

Now when you want to send data from one child form to another you call the appropriate method on the parent.

....
// Going to send data to ChildFormB
ParentForm parent = this.Parent as ParentForm;
 
DataB data = new DataB();
// fill out data class
 
parent.SendToChildB(data);
....
If you wanted to truly adopt .NET practices you would replace the DataSent method and Data properties on the client with events; but for a quick example this works. I'll leave switching to an event as an exercise for you, its not too difficult Smile | :)

HTH,

James

Simplicity Rules!
GeneralRe: Controls across forms? Pin
Brian Olej24-Apr-02 2:31
Brian Olej24-Apr-02 2:31 
GeneralHit Test Pin
23-Apr-02 6:47
suss23-Apr-02 6:47 
GeneralRe: Hit Test Pin
Nick Parker23-Apr-02 8:00
protectorNick Parker23-Apr-02 8:00 
GeneralRe: Hit Test Pin
Neil Van Note23-Apr-02 8:04
Neil Van Note23-Apr-02 8:04 
GeneralRe: GetChildAtPoint *ADVANCED!* Pin
23-Apr-02 9:36
suss23-Apr-02 9:36 
GeneralRe: GetChildAtPoint *ADVANCED!* Pin
Neil Van Note23-Apr-02 10:10
Neil Van Note23-Apr-02 10:10 
GeneralRe: GetChildAtPoint *ADVANCED!* Pin
Neil Van Note23-Apr-02 18:29
Neil Van Note23-Apr-02 18:29 
GeneralA deeper explaination Pin
23-Apr-02 9:49
suss23-Apr-02 9:49 
GeneralConectionStringIII Pin
Mazdak23-Apr-02 5:03
Mazdak23-Apr-02 5:03 
GeneralRe: ConectionStringIII Pin
Neil Van Note23-Apr-02 8:31
Neil Van Note23-Apr-02 8:31 
GeneralRe: ConectionStringIII Pin
Neil Van Note23-Apr-02 8:39
Neil Van Note23-Apr-02 8:39 
GeneralRe: ConectionStringIII Pin
Mazdak23-Apr-02 19:12
Mazdak23-Apr-02 19:12 
GeneralRe: ConectionStringIII Pin
Neil Van Note23-Apr-02 19:20
Neil Van Note23-Apr-02 19:20 
GeneralSystem.Net.dll does not exist! Pin
23-Apr-02 3:58
suss23-Apr-02 3:58 
GeneralRe: System.Net.dll does not exist! Pin
Gavin_Mannion23-Apr-02 4:10
Gavin_Mannion23-Apr-02 4:10 
GeneralRe: System.Net.dll does not exist! Pin
James T. Johnson23-Apr-02 4:19
James T. Johnson23-Apr-02 4:19 
GeneralRe: System.Net.dll does not exist! Pin
23-Apr-02 4:38
suss23-Apr-02 4:38 

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.