Click here to Skip to main content
15,923,689 members
Home / Discussions / C#
   

C#

 
AnswerRe: Is this reflection? Pin
Stanciu Vlad19-Nov-05 22:30
Stanciu Vlad19-Nov-05 22:30 
GeneralRe: Is this reflection? Pin
User 665820-Nov-05 1:26
User 665820-Nov-05 1:26 
GeneralRe: Is this reflection? Pin
Stanciu Vlad20-Nov-05 4:50
Stanciu Vlad20-Nov-05 4:50 
GeneralRe: Is this reflection? Pin
eggie520-Nov-05 8:40
eggie520-Nov-05 8:40 
GeneralRe: Is this reflection? Pin
eggie520-Nov-05 8:53
eggie520-Nov-05 8:53 
GeneralRe: Is this reflection? Pin
Stanciu Vlad20-Nov-05 10:01
Stanciu Vlad20-Nov-05 10:01 
QuestionHelp with Delegates and Events Pin
tawammar19-Nov-05 11:37
tawammar19-Nov-05 11:37 
AnswerRe: Help with Delegates and Events Pin
mikanu19-Nov-05 21:09
mikanu19-Nov-05 21:09 
If CU1 is a custom object that you have designed yourself you could probably use the following example

<code>
namespace TestSpace
{
	public delegate void MyFunc1Handler();  // define the type of function that you are going
                                                // to implement in the owner class and that are
                                                // going to call from the CU1 class
	
	public class CU
	{
		public event MyFunc1Handler OnFunc1Handler;    // define an *event* of type MyFunc1Handler

		public CU()
		{
                        // 
                        // (add your constructor code here)
                        // .......
                        // 
		}
                
                private void someInternalFunction()
                {
                     // 
                     // do something here
                     // ...
                     // ...
                     // 
                     
                     // then fire the function into the owner class
                     OnFunc1(); 
                }

                //
                // (add your functions here)
                // ...
                // ...
                //

		protected virtual void OnFunc1( void)
		{                        
			if( OnFunc1Handler != null )  // make sure the owner assigned a handler to this event
				OnFunc1Handler();     //and call the function into the owner class
	        }
	}
}
</code>


and in your owener class (in your case the Form1 class) just create a function that you will assign to be the handler of the event of type MyFunc1Handler. Basically in the example above the function will have the following signature: void fnName(void);

<code>

public Class Form1: System.Windows.Forms.Form
{
       private TestSpace.CU CU1;

       
       public Form1
       {
              InitializeComponent();
              this.CU1 += new TestSpace.MyFuncHandler1(AFunc1Handler);
       }
 
       private void AFunc1Handler(void)
       {
             //this will be called whenever the CU object calls OnFunc1Handler
       }
}

</code>



Hope this helps
QuestionCustom Object Question Pin
LighthouseJ19-Nov-05 11:32
LighthouseJ19-Nov-05 11:32 
AnswerRe: Custom Object Question Pin
Chris Austin19-Nov-05 12:08
Chris Austin19-Nov-05 12:08 
GeneralRe: Custom Object Question Pin
LighthouseJ19-Nov-05 12:54
LighthouseJ19-Nov-05 12:54 
QuestionDefine Constant class for Const variable Pin
Yanshof19-Nov-05 8:56
Yanshof19-Nov-05 8:56 
AnswerRe: Define Constant class for Const variable Pin
Stanciu Vlad19-Nov-05 9:39
Stanciu Vlad19-Nov-05 9:39 
GeneralRe: Define Constant class for Const variable Pin
David Stone19-Nov-05 10:05
sitebuilderDavid Stone19-Nov-05 10:05 
GeneralRe: Define Constant class for Const variable Pin
Stanciu Vlad19-Nov-05 10:50
Stanciu Vlad19-Nov-05 10:50 
GeneralRe: Define Constant class for Const variable Pin
David Stone19-Nov-05 11:03
sitebuilderDavid Stone19-Nov-05 11:03 
GeneralRe: Define Constant class for Const variable Pin
Robert Rohde19-Nov-05 13:05
Robert Rohde19-Nov-05 13:05 
QuestionWhat Shockwave flash object needs to load flashes on an application with interaction between Csharp and Flash work well? Pin
3DoorsDown19-Nov-05 5:11
3DoorsDown19-Nov-05 5:11 
QuestionRuning a process Pin
Yoyosch19-Nov-05 4:19
Yoyosch19-Nov-05 4:19 
AnswerRe: Runing a process Pin
User 665819-Nov-05 6:09
User 665819-Nov-05 6:09 
GeneralRe: Runing a process Pin
Yoyosch19-Nov-05 6:41
Yoyosch19-Nov-05 6:41 
GeneralRe: Runing a process Pin
User 665819-Nov-05 6:43
User 665819-Nov-05 6:43 
GeneralRe: Runing a process Pin
Yoyosch19-Nov-05 7:52
Yoyosch19-Nov-05 7:52 
GeneralRe: Runing a process Pin
Curtis Schlak.20-Nov-05 6:48
Curtis Schlak.20-Nov-05 6:48 
GeneralRe: Runing a process Pin
Yoyosch20-Nov-05 8:38
Yoyosch20-Nov-05 8: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.