Ejemplo n.º 1
0
        private async void dataGridView1_CellClickAsync(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex == 0)
                {
                    Contact selectedContact = (Contact)dataGridView1.CurrentRow.DataBoundItem;
                    await book.CallContact(selectedContact);

                    rebind_data();
                }
                if (e.ColumnIndex == 1)
                {
                    Contact selectedContact = (Contact)dataGridView1.CurrentRow.DataBoundItem;
                    book.RemoveContact(selectedContact);
                    dataGridView1.Rows.RemoveAt(e.RowIndex);
                    completesource.Remove(selectedContact.ContactName);
                    rebind_data();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }