Changing picture from Listbox - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Changing picture from Listbox

DCADCA Posts: 1Member

I have created a listbox wich changes text i textboxes.

But i need i to change pictures as well.

Lets call the picturebox = picbox1

And an image = pic1.gif and pic2.gif, wich i have imported to the picturebox

if (listbox1.SelectedIndex == 0)


txtbox1.Text = ("4");

txtbox2.Text = ("3");

txtbox3.Text = ("2");

txtbox4.Text = ("1");

// here should pic1.gif be.


if (listbox1.SelectedIndex == 1)

txtbox1.Text = ("8");
txtbox2.Text = ("7");
txtbox3.Text = ("6");
txtbox4.Text = ("5");
// here should pic2.gif be.

What should i add?

Sign In or Register to comment.