コード例 #1
0
 private void buttonUpd_Click(object sender, EventArgs e)
 {
     if (dataGridViewProduct.SelectedRows.Count == 1)
     {
         var form = new FormOutputElement();
         form.Model = productComponents[dataGridViewProduct.SelectedRows[0].Cells[0].RowIndex];
         if (form.ShowDialog() == DialogResult.OK)
         {
             productComponents[dataGridViewProduct.SelectedRows[0].Cells[0].RowIndex] = form.Model;
             LoadData();
         }
     }
 }
コード例 #2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            var form = new FormOutputElement();

            if (form.ShowDialog() == DialogResult.OK)
            {
                if (form.Model != null)
                {
                    if (id.HasValue)
                    {
                        form.Model.OutputID = id.Value;
                    }
                    productComponents.Add(form.Model);
                }
                LoadData();
            }
        }