public imageClass ObtenerImagen(DataTable tbl, int i) { try{ clsobj = new imageClass(); clsobj.id_escudo = Convert.ToInt32(tbl.Rows[i][0]); clsobj.municipio = tbl.Rows[i][1].ToString(); bytes =( Byte[])(tbl.Rows[i][2]); clsobj.Imagen = bytes; }catch (Exception ex){ MessageBox.Show("Error: " + ex.Message, "ObtenerImagen"); MessageBox.Show("Error: " + ex.StackTrace); } return clsobj; }
private void cargarGrid() { objgridimages = new imageClass(); this.Cursor = Cursors.WaitCursor; formatDataGridView();//carta la configueracion del grid try{ gridCatEscudo.DataSource = objgridimages.ObtenerImagenes(); if (gridCatEscudo.Rows.Count == 0) MessageBox.Show("No existen registros ", "Grid Image", MessageBoxButtons.OK, MessageBoxIcon.Information); }catch (Exception ex){ MessageBox.Show("Error: " + ex.Message, "cargarGrid"); MessageBox.Show("Error: " + ex.StackTrace); }finally { objgridimages = null; } this.Cursor = Cursors.Default; }