private void frmProductImageEdit_Load(object sender, EventArgs e) { Product product = new Product(); cmbProduct.DataSource = product.Select().Tables[0]; cmbProduct.DisplayMember = "name"; cmbProduct.ValueMember = "id"; productImage.SelectById(); cmbProduct.SelectedValue = productImage.ProductId; txtTitle.Text = productImage.Title; productImage.Image = productImage.Image; }
public frmProductImageEdit(int id) { InitializeComponent(); Product product = new Product(); cmbProduct.DataSource = product.Select().Tables[0]; cmbProduct.DisplayMember = "name"; cmbProduct.ValueMember = "id"; //cmbProduct.SelectedValue = -1; productImage.Id = id; if (productImage.SelectById()) { txtTitle.Text = productImage.Title; pbImage.Image = FileImage.ImageFromByte(productImage.Image); cmbProduct.SelectedValue = productImage.ProductId; } else { MessageBox.Show(productImage.Error); } }