private void listBox_SelectedIndexChanged(object sender, EventArgs e) { facultyModel fm = (facultyModel)listBox.SelectedItem; facultyIDtext.Text = "" + fm.FacultyID; FacultyNameText.Text = fm.FacultyName; }
private void facultyCombobox_SelectedIndexChanged(object sender, EventArgs e) { listBox1.Items.Clear(); facultyModel fm = (facultyModel)facultyCombobox.SelectedItem; ArrayList alist = DatabaseModel.getDept(fm.FacultyID); IEnumerator en = alist.GetEnumerator(); while (en.MoveNext()) { listBox1.Items.Add(en.Current); } }
public static ArrayList getFaculty() { ArrayList alist = new ArrayList(); string query = "select * from faculty"; OleDbCommand com = new OleDbCommand(query, con); con.Open(); OleDbDataReader read = com.ExecuteReader(); while (read.Read()) { facultyModel rec = new facultyModel(); rec.FacultyID = read.GetInt32(0); rec.FacultyName = read.GetString(1); alist.Add(rec); } con.Close(); return(alist); }