public static Control showStudents() { List <SomerenModel.Student> sl = SomerenDB.DB_gettudents(); ListViewItem li = new ListViewItem(); ListView c = new ListView(); foreach (var item in sl) { SomerenModel.Student Student = new SomerenModel.Student(); Student.setNaam(item.getNaam()); li.SubItems.Add(Student.getNaam()); li.SubItems.Add(Student.getId().ToString()); c.Items.Add(Student.getNaam()); c.Items.Add(li); } int aantal = sl.Count(); c.Height = 1000; return(c); }
public static ListView showStudents() { List <SomerenModel.Student> sl = new List <SomerenModel.Student>(); SomerenDB somerendb = new SomerenDB(); sl = somerendb.DB_gettudents(); ListView c = new ListView(); c.Height = 1000; c.Width = 80; c.View = View.Details; c.Columns.Add("Studenten", 80, HorizontalAlignment.Left); foreach (SomerenModel.Student student in sl) { ListViewItem li = new ListViewItem(student.getNaam()); li.Tag = student; //// li.SubItems.Add(student.getId().ToString()); c.Items.Add(li); } return(c); }