// Codes for the add button which is to display the frmAddModifyGLAccount form private void btnAdd_Click(object sender, EventArgs e) { // Generater a new form instance frmAddModifyState f; f = new frmAddModifyState(); // assignment the addGLAccount global boolean to be true f.addState = true; DialogResult result = f.ShowDialog(); if (result == DialogResult.OK) { selectedState = f.state; txtCode.Text = selectedState.StateCode.ToString(); this.DisplayState(); } }
// Codes for the modify button which is to display the frmAddModifyGLAccount form private void btnModify_Click(object sender, EventArgs e) { // Generater a new form instance frmAddModifyState f; f = new frmAddModifyState(); f.addState = false; f.state = selectedState; DialogResult result = f.ShowDialog(); if (result == DialogResult.OK || result == DialogResult.Retry) { selectedState = f.state; this.DisplayState(); } else if (result == DialogResult.Abort) { txtCode.Text = ""; this.ClearControls(); } }