private void elencoPrestiti(char from) { clsPrestito p = new clsPrestito("Biblioteca.mdf"); if (from == 'L') { if (chkSoloNonRestituiti.Checked == true) { tabellaPrestiti = p.lista(' ', true, Convert.ToInt32(cmbGenere.SelectedIndex + 1)); } else { tabellaPrestiti = p.lista(' ', false, Convert.ToInt32(cmbGenere.SelectedIndex + 1)); } } else { if (chkAggiungiAnnullati.Checked == true) { if (chkSoloNonRestituiti.Checked == true) { tabellaPrestiti = p.lista('A', true, Convert.ToInt32(cmbGenere.SelectedIndex + 1)); } else { tabellaPrestiti = p.lista('A', false, Convert.ToInt32(cmbGenere.SelectedIndex + 1)); } } else if (chkSoloNonRestituiti.Checked == true) { tabellaPrestiti = p.lista(' ', true, Convert.ToInt32(cmbGenere.SelectedIndex + 1)); } else { tabellaPrestiti = p.lista(' ', false, Convert.ToInt32(cmbGenere.SelectedIndex + 1)); } } p.dispose(); dgvElenco.DataSource = tabellaPrestiti; cmbPrestiti.DataSource = tabellaPrestiti; cmbPrestiti.ValueMember = "CodPrestito"; cmbPrestiti.SelectedIndex = -1; annulla(); }