public List <Class_regels> Inladen_regels() { query = "SELECT * FROM [dbo].[Rule]"; List <Class_regels> list_regels = new List <Class_regels>(); cmd = new SqlCommand(query, conn); conn.Open(); myReader = cmd.ExecuteReader(); while (myReader.Read()) { Class_regels class_regels = new Class_regels(); class_regels.RuleId = (int)myReader["RuleId"]; class_regels.Name = myReader["Name"].ToString(); class_regels.Description = myReader["Description"].ToString(); list_regels.Add(class_regels); } conn.Close(); return(list_regels); }
private void Lb_Naamregel_SelectedIndexChanged(object sender, EventArgs e) { try { Class_regels class_regels = new Class_regels(); foreach (Class_regels regels in regel_list) { if (Lb_Naamregel.SelectedItem == regels) { class_regels = regels; break; } } Rtb_Regel_Uitleg.Clear(); Rtb_Regel_Uitleg.Text = class_regels.description; } catch (Exception ex) { throw ex; } }