Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi,

How to get picturebox location value to string variable at runtime in c# windows form. Please help me
Posted
Comments
BillWoodruff 17-Mar-14 3:29am    
You need to tell us exactly what you mean by "location."

Try this,
In this, toy get picture box control location (X and Y co-ordinate )on form.

Point pl = pictureBox1.Location;
string picturebox_X = pl.X.ToString();
string picturebox_Y = pl.Y.ToString();
 
Share this answer
 
Comments
sampletestjava 17-Mar-14 3:33am    
Thanks i am getting the location of picturebox.
SOHAM_GANDHI 17-Mar-14 3:36am    
you are welcome
Try string path = PictureBox.ImageLocation;
 
Share this answer
 
Comments
sampletestjava 17-Mar-14 3:23am    
I am not setting any image to picturebox so getting error as "object reference not set to an instance of an object". I am looking for picturebox location value in form.

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