Click here to Skip to main content
15,887,485 members
Home / Discussions / C#
   

C#

 
AnswerRe: Custom Events Pin
Mark Salsbery11-Dec-08 10:52
Mark Salsbery11-Dec-08 10:52 
GeneralRe: Custom Events Pin
#realJSOP11-Dec-08 12:15
mve#realJSOP11-Dec-08 12:15 
GeneralRe: Custom Events Pin
Mark Salsbery11-Dec-08 12:24
Mark Salsbery11-Dec-08 12:24 
AnswerRe: Custom Events Pin
PIEBALDconsult11-Dec-08 12:15
mvePIEBALDconsult11-Dec-08 12:15 
GeneralRe: Custom Events Pin
#realJSOP11-Dec-08 12:17
mve#realJSOP11-Dec-08 12:17 
GeneralRe: Custom Events Pin
PIEBALDconsult11-Dec-08 13:55
mvePIEBALDconsult11-Dec-08 13:55 
AnswerRe: Custom Events Pin
Christian Graus11-Dec-08 12:44
protectorChristian Graus11-Dec-08 12:44 
AnswerRe: Custom Events Pin
User 433002811-Dec-08 15:02
User 433002811-Dec-08 15:02 
You cannot call directly events of a base class from a child class

You must declare a protected (or other scope) method on the base class to handle that

If you dont want that quit the "event" keyword

public class MyEventArgs : EventArgs
{
	public MyEventArgs()
	{
	}
}

public partial class BaseForm : Form
{
	public delegate void MyEventHandler(object sender, MyEventArgs e);
	public event MyEventHandler MyEventFunction;

	public BaseForm()
	{
		InitializeComponent();
	}
        
        protected virtual void OnMyEventFunction(object sender, MyEventArgs e){
		MyEventFunction(sender, e);
        }
}


public partial class JohnsForm : BaseForm
{
	private void button1_Click(object sender, EventArgs e)
	{
		OnMyEventFunction(this, new MyEventArgsArgs());
	}
}


Saludos!!

____Juan

AnswerRe: Custom Events Pin
DaveyM6912-Dec-08 2:25
professionalDaveyM6912-Dec-08 2:25 
GeneralRe: Custom Events Pin
PIEBALDconsult12-Dec-08 3:06
mvePIEBALDconsult12-Dec-08 3:06 
GeneralRe: Custom Events Pin
DaveyM6912-Dec-08 3:11
professionalDaveyM6912-Dec-08 3:11 
GeneralRe: Custom Events Pin
PIEBALDconsult12-Dec-08 12:50
mvePIEBALDconsult12-Dec-08 12:50 
GeneralRe: Custom Events Pin
DaveyM6913-Dec-08 0:02
professionalDaveyM6913-Dec-08 0:02 
GeneralRe: Custom Events Pin
PIEBALDconsult13-Dec-08 4:04
mvePIEBALDconsult13-Dec-08 4:04 
GeneralRe: Custom Events Pin
DaveyM6913-Dec-08 4:12
professionalDaveyM6913-Dec-08 4:12 
QuestionProg to control other forms Pin
raylion11-Dec-08 9:53
raylion11-Dec-08 9:53 
AnswerRe: Prog to control other forms Pin
Christian Graus11-Dec-08 10:02
protectorChristian Graus11-Dec-08 10:02 
AnswerRe: Prog to control other forms Pin
Andreas Saurwein11-Dec-08 10:35
Andreas Saurwein11-Dec-08 10:35 
AnswerRe: Prog to control other forms Pin
Giorgi Dalakishvili11-Dec-08 19:26
mentorGiorgi Dalakishvili11-Dec-08 19:26 
QuestionSnapping Pin
bsaksida11-Dec-08 9:41
bsaksida11-Dec-08 9:41 
AnswerRe: Snapping Pin
Christian Graus11-Dec-08 9:52
protectorChristian Graus11-Dec-08 9:52 
QuestionC# App without App.Config Pin
shiftyninja11-Dec-08 9:00
shiftyninja11-Dec-08 9:00 
AnswerRe: C# App without App.Config Pin
Christian Graus11-Dec-08 9:21
protectorChristian Graus11-Dec-08 9:21 
GeneralRe: C# App without App.Config Pin
shiftyninja11-Dec-08 10:22
shiftyninja11-Dec-08 10:22 
AnswerRe: C# App without App.Config Pin
blackjack215011-Dec-08 9:56
blackjack215011-Dec-08 9:56 

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.