// this doesn't work, it is for a new case from acvitve cases private void newCaseButt_Click(object sender, EventArgs e) { //Update header currentTabLabel.Text = "New Case"; currentTabLabel.Refresh(); //Make sure the panel is clear displayPanel.Controls.Clear(); //intitalize and add the control to the display panel var myControl = new DocPatSystem.Pharm.makeCasePharm(); displayPanel.Controls.Add(myControl); }
private void newCaseButt_Click(object sender, EventArgs e) { //none of this works :( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Form pharmHome = (this.Parent as Form); if (this.Parent == null || this.Parent.GetType() != typeof(pharmHome)) { return; } Label l = (this.Parent as pharmHome).Controls["currentTabLabel"] as Label; //Update header l.Text = "New Case"; l.Refresh(); //Make sure the panel is clear Panel p = (this.Parent as pharmHome).Controls["currentTabLabel"] as Panel; p.Controls.Clear(); //intitalize and add the control to the display panel var myControl = new DocPatSystem.Pharm.makeCasePharm(); p.Controls.Add(myControl); }