I want display an icon in the picture box. I gave path for icon in following way, it is highlighted is the program. But program is not executing. In attachment you can see the path I gave. Icon number is 12 inside the folder that is why I gave 12 number.
namespace ControlsDemoApp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void pictureBox2_Click(object sender, EventArgs e)
{
pictureBox2.Load("C:\Users\\Maha\Desktop\Icons\12");
}
}
}

Vipan SharmaPosted Dec 7, 2015, 3:27 AM
MahaPosted Dec 7, 2015, 6:32 AM
It is working. Thank you for your explanation.
Upendra Pratap ShahiPosted Dec 7, 2015, 4:12 AM
Ranjit PowarPosted Dec 7, 2015, 12:38 AM
MahaPosted Dec 6, 2015, 11:34 PM
In my system implementation inside the Form1_Load() method gives the desired answer.
private void Form1_Load(object sender, EventArgs e)
{
pictureBox2.ImageLocation = @"C:\Users\Maha\Desktop\Icons\ss.png";
}
But in your system implementation inside the pictureBox2_Click() method gives the desired answer. This is what my concern is. Once I can clear my doubt I have no hesitation to mark your answer as correct.
Vipan SharmaPosted Dec 6, 2015, 11:08 PM
MahaPosted Dec 5, 2015, 9:14 AM
I have fix the problem from your clue.
pictureBox1.Load(@"C:\Users\Maha\Desktop\Icons\12.png");
OR
pictureBox1.ImageLocation= @"C:\Users\\Maha\Desktop\Icons\12.png";
must be implemented inside the Form1_Load() method not inside the pictureBox1_Click()method.
I don’t know how it is executing for you inside the pictureBox1_Click()method.
Anyhow thank for Vipan Sharma and Ranjit Powar who gave me clues.
MahaPosted Dec 5, 2015, 6:57 AM
Vipan SharmaPosted Dec 5, 2015, 6:44 AM
private void pictureBox2_Click(object sender, EventArgs e)
{
pictureBox2.ImageLocation= @"C:\Users\\Maha\Desktop\Icons\12.png";
}
MahaPosted Dec 5, 2015, 6:12 AM
Vipan Sharma I do not have .rar software to unzip your attachment. Please tell me authentic site to download it or provide me a zip copy of this.
MahaPosted Dec 5, 2015, 6:06 AM
Ranjit Powar with the above code program is executing but desired icon is not appearing. Attachment shows the detail.
Vipan SharmaPosted Dec 5, 2015, 5:47 AM
Ranjit PowarPosted Dec 5, 2015, 5:33 AM
MahaPosted Dec 5, 2015, 4:53 AM
Ranjit Powar I have attached the screenshot of output form.
Red arrow indicate icon in the label.
Green arrow is the 1st picture box.
In blue arrow location my 2nd picture box should be there. Which is missing.
MahaPosted Dec 5, 2015, 4:43 AM
Vipan Sharma I have attached the code.
Ranjit PowarPosted Dec 5, 2015, 12:10 AM
Vipan SharmaPosted Dec 5, 2015, 12:07 AM
MahaPosted Dec 4, 2015, 6:23 PM
Praveen DhatrikaPosted Dec 4, 2015, 6:16 PM
MahaPosted Dec 4, 2015, 6:10 PM
Praveen DhatrikaPosted Dec 4, 2015, 5:49 PM
MahaPosted Dec 4, 2015, 5:39 PM
Praveen DhatrikaPosted Dec 4, 2015, 5:13 PM