Click here to Skip to main content
15,893,622 members
Please Sign up or sign in to vote.
3.50/5 (2 votes)
See more:
Hi Guys,

Quick question : I have 2 forms : FORM1 and FORM2. In FORM1 i am trying to implemen a PRINT PREVIW button to work like the PRINT PREVIW button in FORM2.
Here is the delegate, event Starter() and Subscriber() lines.

public delegate void DelegatPrintPreview(object sender, EventArgs e);<br />        public static event DelegatPrintPreview EvenimentDelegatPrintPreview;<br /><br />        public static void StarterPrintPreview(object o, EventArgs ev)<br />        {<br />            if (EvenimentDelegatPrintPreview != null)<br />            {<br />                EvenimentDelegatPrintPreview(o, ev);<br />            }<br />        }<br />        public static void SubscribeToPrintPreview(DelegatPrintPreview pf)<br />        {<br />            EvenimentDelegatPrintPreview += new DelegatPrintPreview(pf);<br />        }



the question is : Where do i put the delegate(in the form with the same button or the other one )? and the same question with the Starter() and Subscriber() methods ?

Regards,
Alex

Posted

1 solution

Firstly, you don't need to define that delegate. The EventHandler delegate has the same signature.

http://msdn.microsoft.com/en-us/library/system.eventhandler.aspx[^]

You'd want to stick your event handler in both forms, and implement each seperately. If they share the same code, put that in a common function and call that from both handlers.

 
Share this answer
 


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900