private void button1_Click_1(object sender, EventArgs e) { if (cbAsig.SelectedIndex >= 0) { if (cbDif.SelectedIndex >= 0) { idA = cbAsig.SelectedIndex + 1; dif = int.Parse(cbDif.SelectedItem.ToString()); co.AgregarTest(idA, dif); MessageBox.Show("Test creado con exito"); this.Dispose(); } else { MessageBox.Show("Debes seleccionar una dificultad primero"); } } else { MessageBox.Show("Debes seleccionar una asignatura primero"); } }