Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            AddEdit ad = new AddEdit();

            ad.metroComboBox1.DataSource    = db.Goods.ToList();
            ad.metroComboBox1.ValueMember   = "id";
            ad.metroComboBox1.DisplayMember = "Name";
            ad.ShowDialog();

            fill();
        }
Пример #2
0
        private void button2_Click(object sender, EventArgs e)
        {
            AddEdit ad = new AddEdit();

            ad.Text         = "تعديل";
            ad.button1.Text = "تعديل";

            ad.textBox1.Text                = DataGrid.CurrentRow.Cells[0].Value.ToString();
            ad.dateTimePicker1.Text         = DataGrid.CurrentRow.Cells[6].Value.ToString();
            ad.textBox2.Text                = DataGrid.CurrentRow.Cells[4].Value.ToString();
            ad.textBox3.Text                = DataGrid.CurrentRow.Cells[7].Value.ToString();
            ad.metroComboBox1.DataSource    = db.Goods.ToList();
            ad.metroComboBox1.ValueMember   = "id";
            ad.metroComboBox1.DisplayMember = "Name";
            ad.metroComboBox1.SelectedValue = Int32.Parse(DataGrid.CurrentRow.Cells[1].Value.ToString());
            ad.ShowDialog();
            fill();
        }