Event

  • Thread starter Thread starter Thomas
  • Start date Start date
T

Thomas

Hi there

I build a class "ButtonClass" with two private
Buttons, "OK" And "Cancel".
Now, I would like to use this class in a Windowsform for
example three times.

ButtonClass c1 = new ButtonClass();
ButtonClass c2 = new ButtonClass();
ButtonClass c3 = new ButtonClass();

I assume the EventListener and its function is in the
ButtonClass. How do I know know which Button was pressed,
because I have just one Listener for each of the Buttons?

Thanks for helping

Thomas
 
Hi,

I maybe wrong here but from what I gather you have a class called
ButtonClass and this class implements the click event. Now, you have created
three ButtonClass objects and want to know which button was pressed in the
click event handler.. I assume you can use the this keyword in the
ButtonClass which will refer to the current object that raised the click
event...

Again, I may have made a mistake in understanding your query..

-Prateek

Hi there

I build a class "ButtonClass" with two private
Buttons, "OK" And "Cancel".
Now, I would like to use this class in a Windowsform for
example three times.

ButtonClass c1 = new ButtonClass();
ButtonClass c2 = new ButtonClass();
ButtonClass c3 = new ButtonClass();

I assume the EventListener and its function is in the
ButtonClass. How do I know know which Button was pressed,
because I have just one Listener for each of the Buttons?

Thanks for helping

Thomas
 
Back
Top