How to tell the difference between two push buttons in a datagrid

G

Guest

I have added two pushbuttons, Select and Update, in a DataGrid, grdFiles, by
Property Builder.

It seems that there is only one event handler for both,
private void grdFiles_SelectedIndexChanged(object sender, System.EventArgs e)
in my application code.

How to add two separate event handlers to handle the push events from these
two buttons, respectively?

Thanks

David
 
G

Guest

You don't need two separate event handlers. You can tell which button
created the event by casting the sender parameter to type Button and looking
at the ID.

Then your handler can have a switch statment (select case in vb.net) to do
your processing.
Peter
 
G

Guest

thanks

Peter Bromberg said:
You don't need two separate event handlers. You can tell which button
created the event by casting the sender parameter to type Button and looking
at the ID.

Then your handler can have a switch statment (select case in vb.net) to do
your processing.
Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,235
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top