private void btnConsultar_Click(object sender, EventArgs e) { //try //{ // var item = dtimg.Consultar(Convert.ToInt32((txtCodigo.Text == "") ? "0" : txtCodigo.Text)); // if (item.Imagen != null) // { // txtDescripcion.Text = item.Descripcion; // pictureBox1.BackgroundImage = System.Drawing.Image.FromStream(item.ayuda); // pictureEdit1.Visible = false; // } // else // MessageBox.Show("No existe Registro"); //} //catch (Exception) //{ //} frmConsultarImagen f = new frmConsultarImagen(); f.ShowDialog(); oImagen = f.oImg; txtCodigo.Text = Convert.ToString(oImagen.IdImagen); txtDescripcion.Text = oImagen.Descripcion; if (oImagen.Imagen != null) { MemoryStream s = new MemoryStream(oImagen.Imagen); //pictureBox1.Image = Image.FromStream(s); pictureBox1.BackgroundImage = Image.FromStream(s); pictureBox1.BackgroundImageLayout = ImageLayout.Stretch; } else { pictureBox1.BackgroundImage = null; } pictureEdit1.Visible = false; // habilitar(false); // btnModificar.Enabled = true; }