private void button6_Click(object sender, EventArgs e) { if (lbSubjects.SelectedItem != null) { int selected = ((Subject)lbSubjects.SelectedItem).ID; controller.FormTest(selected, ""); } }