示例#1
0
        private void btnAddParts_Click(object sender, EventArgs e)
        {
            ComputerPart part  = new ComputerPart();
            Form2        form2 = new Form2(part, true);

            if (form2.ShowDialog() == DialogResult.OK)
            {
                list.Add(part);
                updateSource();
            }
        }
示例#2
0
        private void btnEditParts_Click(object sender, EventArgs e)
        {
            if (list.Count < 1)
            {
                MessageBox.Show("Список пуст!!!");
                return;
            }
            ComputerPart part  = (ComputerPart)ccmbBoxItems.SelectedItem;
            Form2        form2 = new Form2(part, false);

            if (form2.ShowDialog() == DialogResult.OK)
            {
                updateSource();
            }
        }
示例#3
0
 public Form2(ComputerPart _part, bool _addNew)
 {
     InitializeComponent();
     part   = _part;
     addNew = _addNew;
     if (addNew == false)
     {
         txtName.Text    = _part.Name;
         txtCharact.Text = _part.Characteristic;
         txtDescrip.Text = _part.Description;
         txtPrice.Text   = _part.Price.ToString();
         this.Text       = "Редактирование товара";
     }
     else
     {
         this.Text = "Добавление товара";
     }
 }