In this example, i’ll show you how to change image using ComboBox in C# Windows Form App.
Step 1:
Create a windows application and design the form as follows.
Open Visual Studio ->File -> New Project ->Visual C#-> select Windows Forms Application
Give the name of the application and click on OK.

Step 2:
Set the following properties for the controls on the form.
comboBox1>> Name : cmbImage
pictureBox1>> Name : pictureBox1 SizeMode : StretchImage
Step 3:

Right-Click on the project node in the Solution Explorer window and select Add>>New Folder.

Drag and drop your images into Images Folder.
C# Code >> Form_Load
1 2 3 4 5 6 7 8 9 | private void Form1_Load(object sender, EventArgs e) { cmbImage.Items.Add("Cat 1"); cmbImage.Items.Add("Cat 2"); cmbImage.Items.Add("Cat 3"); } |
C# Code>>cmbImage_SelectedIndexChanged
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | private void cmbImage_SelectedIndexChanged(object sender, EventArgs e) { int selct = cmbImage.SelectedIndex; switch(selct) { case 0: pictureBox1.Image = Image.FromFile("..\\..\\Images\\cat1.jpg"); break; case 1: pictureBox1.Image = Image.FromFile("..\\..\\Images\\cat2.jpg"); break; case 2: pictureBox1.Image = Image.FromFile("..\\..\\Images\\cat3.jpg"); break; } } |
Output:
