Name of Image
-
Hey Guys I have a pictureBox which gets its Image from the Resources file. And I have a label where I want to display the name of the Image (which is a .jpg Image). How do I get the name of the Image from the Image file without the .jpg extension. I want the lblInfo to display Cow in this case.
pictureBox1.Image = Resources.Cow; //jpg image Cow.jpg
// lblInfo.Text = -
Hey Guys I have a pictureBox which gets its Image from the Resources file. And I have a label where I want to display the name of the Image (which is a .jpg Image). How do I get the name of the Image from the Image file without the .jpg extension. I want the lblInfo to display Cow in this case.
pictureBox1.Image = Resources.Cow; //jpg image Cow.jpg
// lblInfo.Text =// first import System.IO namespace and then use this one.... lblInfo.Text = Path.GetFileNameWithoutExtension("path of image file");
Software Development & Web Development is my addiction. I am a Visual C# 2.0 and ASP.NET 2.0 Developer and working in Visual Studio 2005 using Dot Net Framework 2.0. Email: bottomless.wisdom@hotmail.com Web: http://bottomless-wisdom.spaces.live.com
-
// first import System.IO namespace and then use this one.... lblInfo.Text = Path.GetFileNameWithoutExtension("path of image file");
Software Development & Web Development is my addiction. I am a Visual C# 2.0 and ASP.NET 2.0 Developer and working in Visual Studio 2005 using Dot Net Framework 2.0. Email: bottomless.wisdom@hotmail.com Web: http://bottomless-wisdom.spaces.live.com
Path.GetFileNameWithoutExtension() method needs a string. And the file which I have included in the Resources file is an Image. How do I give Path.GetFileNameWithoutExtension() a string. I have included the file in the Resources.resx file.
-
Hey Guys I have a pictureBox which gets its Image from the Resources file. And I have a label where I want to display the name of the Image (which is a .jpg Image). How do I get the name of the Image from the Image file without the .jpg extension. I want the lblInfo to display Cow in this case.
pictureBox1.Image = Resources.Cow; //jpg image Cow.jpg
// lblInfo.Text =How can you get an Image Location from an Image object. If that makes it simpler.
-
Hey Guys I have a pictureBox which gets its Image from the Resources file. And I have a label where I want to display the name of the Image (which is a .jpg Image). How do I get the name of the Image from the Image file without the .jpg extension. I want the lblInfo to display Cow in this case.
pictureBox1.Image = Resources.Cow; //jpg image Cow.jpg
// lblInfo.Text =its not possible to get the name from an Image object. You have to code for this. Something like pictureBox1.Image = Image.FromFile("ImagePath"); pictureBox1.Tag = "ImagePath"; now whenever you need the path, just parse the Tag property of PB. In your situation, you may use this
Application.StartupPath + "\\Cow.jpg";
noway to get the path from an Image object AFAIK
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can
-
its not possible to get the name from an Image object. You have to code for this. Something like pictureBox1.Image = Image.FromFile("ImagePath"); pictureBox1.Tag = "ImagePath"; now whenever you need the path, just parse the Tag property of PB. In your situation, you may use this
Application.StartupPath + "\\Cow.jpg";
noway to get the path from an Image object AFAIK
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can
Thanx a lot, thats exactly what I wanted to know. Even though I am not very happy, that the Image object does not return the path or the name of the Image.
-
Thanx a lot, thats exactly what I wanted to know. Even though I am not very happy, that the Image object does not return the path or the name of the Image.
hmmm....i see how happy you are by voting 1 rate :confused:
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L %^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2 W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN% Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia> -------------------------------------------------------- 128 bit encrypted signature, crack if you can