Click here to Skip to main content
15,917,731 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
//Get the blob data in a variable
var data = (Byte[])(dataGridView1.Rows[0].Cells[0].Value);
//Create MemoryStream using blob data of image
var stream = new MemoryStream(data);
//Set the stream data to PictureBox
pictureBox1.Image = Image.FromStream(stream);


this is the code i am having issue with it ....

when i am using this code the picture from datagridview showing to my picturebox but
only RowIndex 0 and ColumnIndex 0 --> image is showing ....not showing accoriding to my my mouseclick on datagridview ...when i clcik on cell 5 -> the image of that row should be displayed the same rowindex 0 and columindex 0 picture again....
var data = (Byte[])(dataGridView1.Rows[e.RowIndex].Cells[0].Value);


What I have tried:

how to show up name.text , surname.text and all even image which is in byte[] and datepicker
<pre>var data = (Byte[])(dataGridView1.Rows[e.RowIndex].Cells[0].Value);
Posted
Updated 7-Oct-17 18:51pm
v2
Comments
Steve44 7-Oct-17 18:51pm    
Can you please provide more details, your description only shows a snippet of code, but no explanation, where your code fails, shows an error or behaves different from your expectation.

One issue that seems strange is in the row you select to show your picture, Cells[1] contains the image as byte array, while later, Cells[1] of the selected row contains the uname. So the content of the rows is different for the same cells?
Richard MacCutchan 8-Oct-17 3:20am    
What is the value of e.RowIndex when you run it? You also need to show where the data variable is used to show the picture.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900