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 SharmaRank #1,589 · 999 reputationPosted Dec 6, 2015, 10:27 PM EST
Praveen DhatrikaRank #3,145 · 455 reputationPosted Dec 4, 2015, 12:13 PM EST
MahaRank #2,573 · 543 reputationPosted Dec 4, 2015, 12:39 PM EST
Praveen DhatrikaRank #3,145 · 455 reputationPosted Dec 4, 2015, 12:49 PM EST
MahaRank #2,573 · 543 reputationPosted Dec 4, 2015, 1:10 PM EST
Praveen DhatrikaRank #3,145 · 455 reputationPosted Dec 4, 2015, 1:16 PM EST
MahaRank #2,573 · 543 reputationPosted Dec 4, 2015, 1:23 PM EST
Vipan SharmaRank #1,589 · 999 reputationPosted Dec 4, 2015, 7:07 PM EST
Ranjit PowarRank #553 · 4.4K reputationPosted Dec 4, 2015, 7:10 PM EST
MahaRank #2,573 · 543 reputationPosted Dec 4, 2015, 11:43 PM EST
Vipan Sharma I have attached the code.
MahaRank #2,573 · 543 reputationPosted Dec 4, 2015, 11:53 PM EST
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.
Ranjit PowarRank #553 · 4.4K reputationPosted Dec 5, 2015, 12:33 AM EST
Vipan SharmaRank #1,589 · 999 reputationPosted Dec 5, 2015, 12:47 AM EST
MahaRank #2,573 · 543 reputationPosted Dec 5, 2015, 1:06 AM EST
Ranjit Powar with the above code program is executing but desired icon is not appearing. Attachment shows the detail.
MahaRank #2,573 · 543 reputationPosted Dec 5, 2015, 1:12 AM EST
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.
Vipan SharmaRank #1,589 · 999 reputationPosted Dec 5, 2015, 1:44 AM EST
private void pictureBox2_Click(object sender, EventArgs e)
{
pictureBox2.ImageLocation= @"C:\Users\\Maha\Desktop\Icons\12.png";
}
MahaRank #2,573 · 543 reputationPosted Dec 5, 2015, 1:57 AM EST
MahaRank #2,573 · 543 reputationPosted Dec 5, 2015, 4:14 AM EST
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.
Vipan SharmaRank #1,589 · 999 reputationPosted Dec 6, 2015, 6:08 PM EST
MahaRank #2,573 · 543 reputationPosted Dec 6, 2015, 6:34 PM EST
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.
Ranjit PowarRank #553 · 4.4K reputationPosted Dec 6, 2015, 7:38 PM EST
Upendra Pratap ShahiRank #329 · 7.5K reputationPosted Dec 6, 2015, 11:12 PM EST
MahaRank #2,573 · 543 reputationPosted Dec 7, 2015, 1:32 AM EST
It is working. Thank you for your explanation.