private void SupplierStoreForm_Load(object sender, EventArgs e) { List <Producer> producers = producerService.getProducers(); var bs1 = new BindingSource(); bs1.DataSource = producers; comboBox1.DataSource = bs1; comboBox1.DisplayMember = "name"; comboBox1.ValueMember = "id"; List <String> types = new List <string>(); foreach (ComponentType type in Enum.GetValues(typeof(ComponentType))) { types.Add(type.ToString()); } var bs2 = new BindingSource(); bs2.DataSource = types; comboBox2.DataSource = bs2; bindingSource1.DataSource = computerComponentSevice.getComputerComponentsInDataTable(); dataGridView1.DataSource = bindingSource1; dataGridView1.Columns[1].Visible = false; dataGridView1.Columns[3].Visible = false; dataGridView1.Columns[4].Visible = false; dataGridView1.Columns[7].Visible = false; if (dataGridView1.Rows.Count > 0) { textBox4.DataBindings.Add("text", bindingSource1, "id", false); //id comboBox2.DataBindings.Add("text", bindingSource1, "Тип компонета"); //тип компонента textBox1.DataBindings.Add("text", bindingSource1, "Название компонента"); //название richTextBox1.DataBindings.Add("text", bindingSource1, "Описание"); //описание comboBox1.DataBindings.Add("SelectedValue", bindingSource1, "ИД производитель"); //производитель textBox2.DataBindings.Add("text", bindingSource1, "Наша цена"); //цена textBox3.DataBindings.Add("text", bindingSource1, "Количество на складе"); //количество textBox5.DataBindings.Add("text", bindingSource1, "ИД компонента на складе", false); //id } if (!String.IsNullOrEmpty(textBox5.Text)) { label8.Text = "На вашем складе имеется этот компонент"; } else { label8.Text = "На вашем складе нет этого компонента"; } }