i am able to upload a image through the above link now i want to retrive that uploded image to my data gried of wpf appliction i am using this code but that not working
how to dishplay the image in datagrid of wpf application?
http://msdotnetninja.blogspot.in/2013/12/wpf-browse-image-with-openfiledialog.html
i am able to upload a image through the above link now i want to retrive that uploded image to my data gried of wpf appliction i am using this code but that not working
i am able to upload a image through the above link now i want to retrive that uploded image to my data gried of wpf appliction i am using this code but that not working
Munesh SharmaPosted Mar 27, 2014, 5:38 AM
But now case is diff,
So you needs to create DataGridViewRow' object and after that you can add the rows to your data grid view.
Sorry, I do not have any editor installed with me, so understand any syntactical mistakes....
eg.
if (con.state== ConnectionState.Closed)
{
con.open();
}
cmd.connection=con;
cmd.commandText="select * from tablename"
dr=cmd.executeReader();
//dr is an instance of sqlDataReader or oledbDataReader
while(dr.read)
{
String picPath;
DatagridViewRow dgvr=new DataGridViewRow();
dgvr.cells[0].value=dr.getInt32(0); //ie. id
dgvr.cells[1].value=dr.getString(1); //ie. name
picPath=dr.getString(2); //ie. image path
Image newImage = Image.FromFile(picPath);
dgvr.cells[2].value=newImage; //create new object of System.Drawing.Image class
datagridViewobj.rows.add(dgvr); // add created row to datagridview
}