Picture Box Address Problem
Page 1 of 19 Replies - 689 Views - Last Post: 15 July 2010 - 09:47 AM
#1
Picture Box Address Problem
Posted 15 July 2010 - 04:27 AM
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
Replies To: Picture Box Address Problem
#2
Re: Picture Box Address Problem
Posted 15 July 2010 - 04:40 AM
If so, use the ImageLocation property of the PictureBox.
#3
Re: Picture Box Address Problem
Posted 15 July 2010 - 05:01 AM
#4
Re: Picture Box Address Problem
Posted 15 July 2010 - 08:44 AM
#5
Re: Picture Box Address Problem
Posted 15 July 2010 - 09:30 AM
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
#6
Re: Picture Box Address Problem
Posted 15 July 2010 - 09:34 AM
#7
Re: Picture Box Address Problem
Posted 15 July 2010 - 09:36 AM
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
#8
Re: Picture Box Address Problem
Posted 15 July 2010 - 09:40 AM
#9
Re: Picture Box Address Problem
Posted 15 July 2010 - 09:46 AM
thank you all
#10
Re: Picture Box Address Problem
Posted 15 July 2010 - 09:47 AM
hamidkhl, on 15 July 2010 - 11:30 AM, said:
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.
|
|

New Topic/Question
Reply



MultiQuote




|