private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { ProgramModel ob = (ProgramModel)listBox1.SelectedItem; IDtext.Text = "" + ob.ProgID; programNameText.Text = ob.Program; ProgramDurationtext.Text = "" + ob.DurationSem; }
private void programcomboBox_SelectedIndexChanged(object sender, EventArgs e) { listBox1.Items.Clear(); ProgramModel ob = (ProgramModel)programcomboBox.SelectedItem; ArrayList alist = DatabaseModel.getBatch(ob.ProgID); IEnumerator en = alist.GetEnumerator(); while (en.MoveNext()) { listBox1.Items.Add(en.Current); } }
public static ArrayList getProgram(int deptid) { ArrayList alist = new ArrayList(); string query = "select * from program where dept_id=" + deptid; OleDbCommand com = new OleDbCommand(query, con); con.Open(); OleDbDataReader read = com.ExecuteReader(); while (read.Read()) { ProgramModel rec = new ProgramModel(); rec.ProgID = read.GetInt32(0); rec.DeptID = read.GetInt32(1); rec.Program = read.GetString(2); rec.DurationSem = read.GetInt32(3); alist.Add(rec); } con.Close(); return(alist); }