Click here to Skip to main content
15,886,806 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello frens , i have a small problem and i could not find suitable solution please help me

C#
string imagepath = dataGridView1.CurrentRow.Cells[15].Value.ToString();
          if (imagepath != null)
          {
              frm.pictureBox1.Image = Image.FromFile(imagepath);
          }
          else
          {
              frm.pictureBox1.Image = null;
          }


this didnot get my pixturebox with null value and simply throws exception

with regards bishnu
Posted
Updated 9-Feb-12 23:12pm
v2
Comments
MadhuCodePro 10-Feb-12 4:47am    
What exception you are getting?
Can you post the details?

1 solution

take a NoImage.gif file for showing blank Picture Box.
C#
string imagepath = dataGridView1.CurrentRow.Cells[15].Value.ToString();
                  if (imagepath != null)
                  {
                        frm.pictureBox1.Image = Image.FromFile(imagepath);
                  }
                  else
                  {
                        frm.pictureBox1.Image = Image.FromFile("path of No Image");
                  }
 
Share this answer
 
Comments
MCY 11-Feb-12 15:22pm    
yep, that's what i usually do

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