I have a win form with a dataGrid which acts a queue before choosing a command for the queue of items: add [rows in datagrid to database], delete all[rows from datagrid], dlete selected [row from datagrid].
For UI improvements, I'm trying to make only the available options enabled: i.e. if no row exists in the datagrid, the "Add All" and "Delete All" buttons are disabled.
I have code that pulls the row numbers of the selected rows (I can delete the selected rows w/o a problem), but where do I call this code from so that it enabled/disables the "Delete Selected" button based on if the user just highlighted a row(s) or not? Should I put it in the _onPaint event (doesn't seem efficient). Maybe in the _KeyPress and _Click events of the form?