protected void CustomerDeleteButton_Click(object sender, EventArgs e) { clsCustomerCollection Customers = new clsCustomerCollection(); if (CustomerListBox.SelectedIndex != -1) { int Id = Convert.ToInt32(CustomerListBox.SelectedValue); Customers.thisCustomer.Find(Id); clsCustomer selectedCustomer = Customers.thisCustomer; Customers.delete(); } else { ErrorLabel.Text = "[!] A record must be selected"; } }