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

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
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
 
Back
Top