9 Replies - 810 Views - Last Post: 15 July 2010 - 09:47 AM Rate Topic: -----

#1 hamidkhl  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 118
  • Joined: 03-November 08

Picture Box Address Problem

Posted 15 July 2010 - 04:27 AM

Hi every body
what is property of picture address in picture box
I want set a picture to a pucture box by string address
of my picture
thank you
Is This A Good Question/Topic? 0
  • +

Replies To: Picture Box Address Problem

#2 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1524
  • View blog
  • Posts: 5,957
  • Joined: 21-March 08

Re: Picture Box Address Problem

Posted 15 July 2010 - 04:40 AM

Do you mean that you want to give the PictureBox a URL to an image on the internet and have the PictureBox show that image?

If so, use the ImageLocation property of the PictureBox.
Was This Post Helpful? 0
  • +
  • -

#3 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1252
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: Picture Box Address Problem

Posted 15 July 2010 - 05:01 AM

There is two ways, you can use the .Image property to set a Image object to display, or you can use the .ImageLocation if you want to give it an address and have the picture box do its magic.
Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq  Icon User is online

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5442
  • View blog
  • Posts: 11,676
  • Joined: 02-June 10

Re: Picture Box Address Problem

Posted 15 July 2010 - 08:44 AM

http://msdn.microsof...s(v=VS.71).aspx
Was This Post Helpful? 0
  • +
  • -

#5 hamidkhl  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 118
  • Joined: 03-November 08

Re: Picture Box Address Problem

Posted 15 July 2010 - 09:30 AM

thank you dear stapia.gutierrez
I did it like this
PbPerson.ImageLocation = "C:\\ShowImage.GPEG";


but it doesn't show my image, whats wrong?

This post has been edited by hamidkhl: 15 July 2010 - 09:34 AM

Was This Post Helpful? 0
  • +
  • -

#6 Curtis Rutland  Icon User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4440
  • View blog
  • Posts: 7,721
  • Joined: 08-June 10

Re: Picture Box Address Problem

Posted 15 July 2010 - 09:34 AM

Do you really have an image named "ShowImage.GPEG"? Are you sure it's not "JPEG"?
Was This Post Helpful? 0
  • +
  • -

#7 tlhIn`toq  Icon User is online

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5442
  • View blog
  • Posts: 11,676
  • Joined: 02-June 10

Re: Picture Box Address Problem

Posted 15 July 2010 - 09:36 AM

Is your file extension really "GPEG" ? With a G. Not "JPEG" or "JPG".

Might I recommend you get in the habit of confirming files exist before trying to use them?

string myPath = "c:\\ShowImage.jpg";
if (System.IO.File.Exists(myPath)
{
   // Do something with the picture.
}
else
{
   MessageBox.Show("File is missing", "Dork");
}

This post has been edited by tlhIn'toq: 15 July 2010 - 09:37 AM

Was This Post Helpful? 3
  • +
  • -

#8 hamidkhl  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 118
  • Joined: 03-November 08

Re: Picture Box Address Problem

Posted 15 July 2010 - 09:40 AM

View PostinsertAlias, on 15 July 2010 - 08:34 AM, said:

Do you really have an image named "ShowImage.GPEG"? Are you sure it's not "JPEG"?

Yes,
Was This Post Helpful? 0
  • +
  • -

#9 hamidkhl  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 118
  • Joined: 03-November 08

Re: Picture Box Address Problem

Posted 15 July 2010 - 09:46 AM

YES, I'm Crazy, file type is JPG
thank you all
Was This Post Helpful? 0
  • +
  • -

#10 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1252
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: Picture Box Address Problem

Posted 15 July 2010 - 09:47 AM

View Posthamidkhl, on 15 July 2010 - 11:30 AM, said:

thank you dear stapia.gutierrez
I did it like this
PbPerson.ImageLocation = "C:\\ShowImage.GPEG";


but it doesn't show my image, whats wrong?


Are you having an exceptions when you run that line of code? Or does the picturebox just not show anything?

Try doing this:

PbPerson.ImageLocation = @"C:\ShowImage.GPEG";


Also, TRIPLE check that your extension really is GPEG because I've never heard of that extension for images before. I'd really recommend you use Toq's code to check if the file even exists before you try to act upon it.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1