protected virtual void OnTransferSelectedRows(TransferSelectedRowsEventArgs e) { TransferSelectedRowsEventHandler handler = TransferSelectedRows; if (handler != null) { handler(this, e); } }
//Click event handler for button1 private void button1_Click(object sender, EventArgs e) { var transfer = new TransferSelectedRowsEventArgs(dataGridView1); OnTransferSelectedRows(transfer); if (!transfer.HasRows) { MessageBox.Show("There is no data to export, please verify..!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }