private void MembershipMaintenance_Load(object sender, EventArgs e) { membership.write(path); //wire event normally: //membership.Changed += new MembershipList.changeHolder(ListChanged); //wire event using lambda expression: membership.Changed += membershiplist => { //update list box this.members.Items.Clear(); for (int i = 0; i < membershiplist.Count; i++) { this.members.Items.Add(membershiplist[i].getDisplayText()); } //save membershiplist.save(path); }; //initialize list box for (int i = 0; i < membership.Count; i++) { this.members.Items.Add(membership[i].getDisplayText()); } //this.members.Items.AddRange(); }
private void AddMembership_Load(object sender, EventArgs e) { membership.write(path); }