private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { batchModel ob = (batchModel)listBox1.SelectedItem; IDtext.Text = "" + ob.Batchid; batchYeartext.Text = "" + ob.Batchyear; batchShifttext.Text = ob.batchShift; grpDecText.Text = ob.Grpdesc; }
private void batchcomboBox1_SelectedIndexChanged(object sender, EventArgs e) { listBox1.Items.Clear(); batchModel ob = (batchModel)batchcomboBox1.SelectedItem; ArrayList alist = DatabaseModel.getStudentsReg(ob.Batchid); IEnumerator en = alist.GetEnumerator(); while (en.MoveNext()) { listBox1.Items.Add(en.Current); } }
public static ArrayList getBatch(int progid) { ArrayList alist = new ArrayList(); string query = "select * from batch where prog_id=" + progid; OleDbCommand com = new OleDbCommand(query, con); con.Open(); OleDbDataReader read = com.ExecuteReader(); while (read.Read()) { batchModel rec = new batchModel(); rec.Batchid = read.GetInt32(0); rec.Progid = read.GetInt32(1); rec.Batchyear = read.GetInt32(2); rec.batchShift = read.GetString(3); rec.Grpdesc = read.GetString(4); alist.Add(rec); } con.Close(); return(alist); }