Click here to Skip to main content
15,921,174 members
Home / Discussions / C#
   

C#

 
AnswerRe: List classList = new List(); Pin
- Pascal -27-May-07 8:12
- Pascal -27-May-07 8:12 
GeneralRe: List classList = new List(); Pin
sharp source27-May-07 12:42
sharp source27-May-07 12:42 
GeneralRe: List classList = new List(); Pin
- Pascal -28-May-07 2:18
- Pascal -28-May-07 2:18 
GeneralRe: List classList = new List(); Pin
sharp source29-May-07 7:58
sharp source29-May-07 7:58 
Questionstatic variable or delegates and events ! Pin
Hussam Fattahi27-May-07 4:32
Hussam Fattahi27-May-07 4:32 
AnswerRe: static variable or delegates and events ! Pin
Colin Angus Mackay27-May-07 4:34
Colin Angus Mackay27-May-07 4:34 
AnswerRe: static variable or delegates and events ! Pin
Luc Pattyn27-May-07 5:13
sitebuilderLuc Pattyn27-May-07 5:13 
AnswerRe: static variable or delegates and events ! Pin
Are Jay27-May-07 11:29
Are Jay27-May-07 11:29 
I would use a delegate and event.

//Delegate
public delegate ChatWindowClosingHandler(object sender, EventArgs args);

public interface IChatWindowManager {
     void ChatWindowClosing(object sender, EventArgs args);
}

public partial class ChatManagerForm : Form, IChatFormsManager{

     public event ChatWindowClosingHandler OnChatWindowClosing;

     public void ChatWindowClosing(object sender, EventArgs args){
          // Handler the event and/or adjust local variables
     }

     public ChatManagerForm(){
          InitializeComponent();
          this.OnChatWindowClosing += new ChatWindowClosingHandler( ChatWindowClosing );
     }
}

public partial class ChatWindowForm : Form {

     public ChatWindowForm( IChatFormsManager cfm ){
          InitializeComponent();

          // this is now calling the parent forms 
          // ChatWindowClosing method when the child
          // form event occurs.
          this.FormClosed += new ChatWindowClosingHandler( cfm.ChatWindowClosing );
     }
}


I have not had a chance to test the above code but I've used this design pattern many of times. I guess you've gotten three differnet answers to your question. lol. I hope this is helpful.

I'm listening but I only speak GEEK.

Questionautomation Pin
s_khan_87627-May-07 3:04
s_khan_87627-May-07 3:04 
AnswerRe: automation Pin
Colin Angus Mackay27-May-07 4:33
Colin Angus Mackay27-May-07 4:33 
Jokeyou (like me) cannot understand... Pin
CPallini27-May-07 4:37
mveCPallini27-May-07 4:37 
GeneralRe: you (like me) cannot understand... Pin
Dave Herren27-May-07 4:47
Dave Herren27-May-07 4:47 
GeneralRe: you (like me) cannot understand... Pin
CPallini27-May-07 7:40
mveCPallini27-May-07 7:40 
QuestionwebBrowser navigating event problem Pin
Opa Knack27-May-07 2:40
Opa Knack27-May-07 2:40 
QuestionUsing Resource Files to Store Images C# Pin
Joseph Stanish27-May-07 1:50
Joseph Stanish27-May-07 1:50 
AnswerRe: Using Resource Files to Store Images C# Pin
Colin Angus Mackay27-May-07 4:31
Colin Angus Mackay27-May-07 4:31 
GeneralRe: Using Resource Files to Store Images C# Pin
Joseph Stanish29-May-07 6:11
Joseph Stanish29-May-07 6:11 
QuestionHow to retrieve a row from stored procedure Pin
Mujz.........27-May-07 1:06
Mujz.........27-May-07 1:06 
AnswerRe: How to retrieve a row from stored procedure Pin
Christian Graus27-May-07 1:21
protectorChristian Graus27-May-07 1:21 
Questionhow to read an excel sheet. Pin
Mujz.........27-May-07 1:01
Mujz.........27-May-07 1:01 
AnswerRe: how to read an excel sheet. Pin
Christian Graus27-May-07 1:22
protectorChristian Graus27-May-07 1:22 
Questionupgrade C# application from 1.1 to 2.0 Pin
unitecsoft26-May-07 22:02
unitecsoft26-May-07 22:02 
AnswerRe: upgrade C# application from 1.1 to 2.0 Pin
Christian Graus26-May-07 23:23
protectorChristian Graus26-May-07 23:23 
GeneralRe: upgrade C# application from 1.1 to 2.0 Pin
unitecsoft27-May-07 2:58
unitecsoft27-May-07 2:58 
GeneralRe: upgrade C# application from 1.1 to 2.0 Pin
Dave Kreskowiak27-May-07 4:25
mveDave Kreskowiak27-May-07 4:25 

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.