Пример #1
0
        private void buttonAddCollective_Click(object sender, EventArgs e)
        {
            AddCollectiveGenre f13 = new AddCollectiveGenre();

            f13.Text = "Add Collective";
            if (f13.ShowDialog() == DialogResult.OK)
            {
                using (MyDbContext context = new MyDbContext())
                {
                    bindingSource1.DataSource = context.Collectives.ToList();
                    dataGridView1.DataSource  = bindingSource1;
                }
            }
        }
Пример #2
0
        private void buttonAddGenre_Click(object sender, EventArgs e)
        {
            AddCollectiveGenre f13 = new AddCollectiveGenre("genre");

            f13.Text = "Add Genre";
            if (f13.ShowDialog() == DialogResult.OK)
            {
                using (MyDbContext context = new MyDbContext())
                {
                    bindingSource1.DataSource = context.Genres.ToList();
                    dataGridView1.DataSource  = bindingSource1;
                    dataGridView1.Columns["Disks"].Visible = false;
                }
            }
        }
Пример #3
0
        private void buttonAddCollective_Click(object sender, EventArgs e)
        {
            AddCollectiveGenre form13 = new AddCollectiveGenre();

            form13.Text = "Add Collective";
            if (form13.ShowDialog() == DialogResult.OK)
            {
                using (MyDbContext context = new MyDbContext())
                {
                    comboBoxCollective.Items.Clear();
                    foreach (var item in context.Collectives.ToList())
                    {
                        comboBoxCollective.Items.Add(item);
                    }
                    comboBoxCollective.SelectedIndex = (comboBoxCollective.Items.Count) - 1;
                }
            }
        }