private void FrmOrganisationList_VisibleChanged(object sender, EventArgs e) { // if change for invisible to visible if (!isVisible && this.Visible) { organisationList = db.GetOrganisationList(); List <organisation> temp = organisationList; foreach (DataGridViewRow row in dgv_organisation.Rows) { organisation o = temp.FirstOrDefault(i => i.id == Convert.ToInt32(row.Cells[0].Value)); if (o == null) { dgv_organisation.Rows.Remove(row); continue; } row.Cells[1].Value = o.name; row.Cells[2].Value = o.email; row.Cells[3].Value = o.tel; row.Cells[4].Value = o.address; temp.Remove(o); } if (temp.Count > 0) { foreach (organisation o in temp) { dgv_organisation.Rows.Add(o.id, o.name, o.email, o.tel, o.address); } } } isVisible = this.Visible; }
public FrmNewCollection(FrmHomepage parent) { InitializeComponent(); this.parent = parent; tableLayoutPanel2.SetColumnSpan(txt_address, 3); tableLayoutPanel2.SetColumnSpan(ckBox_newOrg, 2); db = new SignChatDB(); organisations = db.GetOrganisationList(); // set organisation cbBox cbBox_organisation.TabIndex = 0; foreach (organisation o in organisations) { String item = String.Format("{0,-10}{1}", o.id, o.name); cbBox_organisation.Items.Add(item); } // set organisation txt txt_organisation = new TextBox(); txt_organisation.Anchor = (AnchorStyles.Left | AnchorStyles.Right); txt_organisation.TabIndex = 0; txt_orgEmail.ReadOnly = true; txt_orgTel.ReadOnly = true; txt_address.ReadOnly = true; }
public FrmOrganisationList(FrmHomepage parent) { InitializeComponent(); this.parent = parent; db = new SignChatDB(); organisationList = db.GetOrganisationList(); UpdateList(organisationList); }