Elmo Erasmus
asked on
Click event for button in DataGridViewButtonColumn
Hi
I've got a DataGridView on a windows form with various columns added by the Data Source. I also added a DataGridViewButtonColumn. The problem I'm having is that I have no idea how to add code to these buttons. Pls Help
Thanks
Elmo
I've got a DataGridView on a windows form with various columns added by the Data Source. I also added a DataGridViewButtonColumn. The problem I'm having is that I have no idea how to add code to these buttons. Pls Help
Thanks
Elmo
To handle the “button click,” you need to handle the CellClick event on the grid, determine if it was a button cell that was clicked, and then take the appropriate action for your application. This involves taking the event argument from the CellClick event, checking its ColumnIndex property against the column index of button columns in your grid, and then calling the button click handling code from there based on the row index, or the contents of that cell or others in that row.
ASKER
Can you perhaps help me with a bit of sample code?
Thanks
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much!
Thank you!