private void button1_Click(object sender, EventArgs e) { frmAddModifySupplierContact frm = new frmAddModifySupplierContact(); frm.isAddSupplierContact = true; int index = lstSupplier.SelectedIndex; supplier = suppliers[index]; frm.supplierId = supplier.SupplierId; frm.Show(); }
private void btnModify_Click(object sender, EventArgs e) { frmAddModifySupplierContact frm = new frmAddModifySupplierContact(); frm.isAddSupplierContact = false; int index = lstSupplier.SelectedIndex; supplier = suppliers[index]; frm.supplierContact = contact; frm.Show(); }
private void btnModify_Click(object sender, EventArgs e) { frmAddModifySupplierContact frm = new frmAddModifySupplierContact(); frm.isAddSupplierContact = false; int index = lstSupplier.SelectedIndex; supplier = suppliers[index]; frm.supplierContact = contact; //frm.Show(); DialogResult rslt = frm.ShowDialog(); if (rslt == DialogResult.OK) { setSupplierContacts(); clearSupplierContact(); } else if (rslt == DialogResult.Retry) { if (contact != null) setSupplierContacts(); else clearSupplierContact(); } }
//Event handler for add button click //opens modify/add form and passes relevent data private void btnAdd_Click(object sender, EventArgs e) { frmAddModifySupplierContact frm = new frmAddModifySupplierContact();//create form instance frm.isAddSupplierContact = true; //true value tells form to add int index = lstSupplier.SelectedIndex; //get selected supplier supplier = suppliers[index]; //set supplier holder to supplier in list frm.supplierId = supplier.SupplierId; //pass supplier object to add contact into //frm.Show(); //show form DialogResult rslt = frm.ShowDialog(); //if modify ok if (rslt == DialogResult.OK) { setSupplierContacts(); //reset supplier contacts clearSupplierContact(); //clear display form } //if modify failed and retries else if (rslt == DialogResult.Retry) { if (contact != null) setSupplierContacts(); else clearSupplierContact(); } }
//event handler for modify button private void btnModify_Click(object sender, EventArgs e) { frmAddModifySupplierContact frm = new frmAddModifySupplierContact(); //create instance of form frm.isAddSupplierContact = false; //set to false for modify int index = lstSupplierContacts.SelectedIndex; //get index of supplier contact = contacts[index]; frm.supplierContact = contact; //pass current contact to form DialogResult rslt = frm.ShowDialog(); //get result of modify //if modify ok if (rslt == DialogResult.OK) { setSupplierContacts(); //reset supplier contacts clearSupplierContact(); //clear display form } //if modify failed and retries else if (rslt == DialogResult.Retry) { if (contact != null) setSupplierContacts(); else clearSupplierContact(); } }