Esempio n. 1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            try
            {
                VendorDetails f = new VendorDetails(true, Convert.ToInt32(dGridVendors.SelectedRows[0].Cells[0].Value));
                f.btnClear.Enabled = false;
                f.btnSave.Text     = "Update";
                f.txtName.Text     = dGridVendors.SelectedRows[0].Cells[1].Value.ToString();
                f.txtStreet.Text   = dGridVendors.SelectedRows[0].Cells[2].Value.ToString();
                if (dGridVendors.SelectedRows[0].Cells[3].Value == null)
                {
                    f.txtStreet2.Text = "";
                }
                else
                {
                    f.txtStreet2.Text = dGridVendors.SelectedRows[0].Cells[3].Value.ToString();
                }

                f.txtCity.Text    = dGridVendors.SelectedRows[0].Cells[4].Value.ToString();
                f.txtState.Text   = dGridVendors.SelectedRows[0].Cells[5].Value.ToString();
                f.txtZip.Text     = dGridVendors.SelectedRows[0].Cells[6].Value.ToString();
                f.txtCountry.Text = dGridVendors.SelectedRows[0].Cells[7].Value.ToString();
                f.ShowDialog();
                LoadData();
            }
            catch (ArgumentOutOfRangeException)
            {
                MessageBox.Show("Please select entire row to edit.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Esempio n. 2
0
        private void Insert_Click(object sender, EventArgs e)
        {
            VendorDetails f = new VendorDetails();

            f.ShowDialog();

            //reloads data on form3
            LoadData();
        }