private void btnDelete_Click(object sender, EventArgs e) { if (!_memberRepo.RemoveMember(_memberRepo.GetAllMembers()[_index].MemberId)) { MessageBox.Show("Cannot remove member that is currently renting an book", "Rent error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } _index = 0; SetData(); }