private void FormCreateOrder_Load(object sender, EventArgs e) { try { List <ManufactureViewModel> list = _logicP.Read(null); if (list != null) { comboBoxProduct.DisplayMember = "ProductName"; comboBoxProduct.ValueMember = "Id"; comboBoxProduct.DataSource = list; comboBoxProduct.SelectedItem = null; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void LoadData() { try { var list = logic.Read(null); if (list != null) { dataGridView.DataSource = list; dataGridView.Columns[0].Visible = false; dataGridView.Columns[3].Visible = false; dataGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; dataGridView.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }