Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

how do i refresh the form?

$
0
0
            

the following code is in frmMain which is display only.

frmPerson is the add/edit form that sets the values of the PER class.

everything works fine in frmPerson, but i need to know what code i need to replace the comment for frmMain to display the new values.

Thanks in advance for any help.

private void DisplayPerson()

        {
            lblID.Text = PER.ID.ToString();
            txtID.Text = PER.ID.ToString();
            lblFirst.Text = PER.First;
            lblLast.Text = PER.Last;
            lblAddr.Text = PER.Addr;
            lblCityState.Text = PER.City + "," + PER.State;
            lblZip.Text = PER.Zip;
            lblCode.Text = "";
            lblBirth.Text = PER.bMonth.ToString() + " /" + PER.bDay.ToString();
            if (PER.Active)
            {
                lblActive.Text = "active";
            }
            else
            {
                lblActive.Text = "inactive";
            }
            lblCode.Text = PER.Code;
            lblFullPhone.Text = PER.AreaCode.ToString() + "-" + PER.PhoneNbr;

            btnEdit.Enabled = true;
            btnEdit.Focus();

        }

private void btnEdit_Click(object sender, EventArgs e)
        {
            frmPerson EditPersonForm = new frmPerson();
            EditPersonForm.PER = this.PER;
            EditPersonForm.AddPerson = false;
            DialogResult Dresult = EditPersonForm.ShowDialog();
            if (Dresult == DialogResult.OK)
            {
                PER = EditPersonForm.PER;
                DisplayPerson();
                //what do i need here to make the new values show?
            }
        }


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>