コード例 #1
0
        public AddProductForm()
        {
            InitializeComponent();

            comboBoxUnit.Items.Clear();
            comboBoxUnit.Items.AddRange(DbEditor.GetAllUnits());

            comboBox2.SelectedIndex = 1;
        }
コード例 #2
0
ファイル: UnitForm.cs プロジェクト: nopills/Business-Helper
 private void button1_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(textBox1.Text) && !String.IsNullOrEmpty(textBox2.Text))
     {
         DbEditor.AddUnit(new Unit {
             Name = textBox1.Text, Code = textBox2.Text
         });
         AddProductForm AddProductForm = (AddProductForm)this.Owner;
         AddProductForm.comboBoxUnit.Items.Clear();
         AddProductForm.comboBoxUnit.Items.AddRange(DbEditor.GetAllUnits());
         this.Hide();
     }
     else
     {
         MessageBox.Show("Поля ввода не могут быть пустыми", "Внимание",
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Error);
     }
 }