so i’ve this assignment that im supposed to do a which is a c# wfa that contains 2 buttons one labeled as show head and another for show tail and when i click on of them it should shows the picture of it
i’ve added the 2 button labeled them and added 2 pictures box then i looked it up i found i shoud in every button right a code like this
pictureBox1.Image = Image.FromFile(Properties.Resources.Head);
but it give me error says that i cannot convert from system.drawing.bitmap to string
note: i’ve added the pictures in the resoureces
>Solution :
Image.FromFile method accepts a file path in string form. while you an image bitmap itself in resource (and not a location of the image present in local/remote directory)
refer this: https://docs.microsoft.com/en-us/dotnet/api/system.drawing.image.fromfile?view=dotnet-plat-ext-6.0
So for solution part, instead of
pictureBox1.Image = Image.FromFile(Properties.Resources.Head);
try this
pictureBox1.Image = Properties.Resources.Head