Duggi kirjoitti:
> On Oct 8, 10:42 am, za...@construction-imaging.com wrote:
>> On Oct 8, 1:09 pm, Duggi <DuggiSrinivasa...@gmail.com> wrote:
>>
>>> On Oct 8, 10:01 am, saulij <sau...@hotmail.com> wrote:
>>>> I have an array of buttons. There is a common Click-method for these
>>>> buttons.
>>>> How can I find what button is clicked?
>>>> Sauli
>>> In the event handler, first arg would be "object sender". you can
>>> identify the sender through this argument. (I believe so)
>> I haven't tried this but it should work.
>>
>> Private void Common_Click(Object sender, EventArgs e)
>> {
>> Button btn = (Button)sender;
>> switch (btn.Name)
>> {
>> case "btnButton1":
>> Do something for button1;
>> break;
>> case "btnButton2":
>> Do something for button2;
>> break;
>> etc ...
>> }
>>
>>
>>
>> }- Hide quoted text -
>>
>> - Show quoted text -
>
> nice to see some code here. The same approach I was suggesting.
>
> Saulij, Please let us know if it solves your issue.
>
> -Cnu
This works fine, Thanks a lot
sauli
|