Beispiel #1
0
        private void buttonAddPublisher_Click(object sender, EventArgs e)
        {
            AddPublisher f14 = new AddPublisher();

            if (f14.ShowDialog() == DialogResult.OK)
            {
                using (MyDbContext context = new MyDbContext())
                {
                    bindingSource1.DataSource = context.Publishers.ToList();
                    dataGridView1.DataSource  = bindingSource1;
                }
            }
        }
        private void buttonAddPublisher_Click(object sender, EventArgs e)
        {
            AddPublisher form14 = new AddPublisher();

            if (form14.ShowDialog() == DialogResult.OK)
            {
                using (MyDbContext context = new MyDbContext())
                {
                    comboBoxPublisher.Items.Clear();
                    foreach (var item in context.Publishers.ToList())
                    {
                        comboBoxPublisher.Items.Add(item);
                    }
                    comboBoxPublisher.SelectedIndex = (comboBoxPublisher.Items.Count) - 1;
                }
            }
        }