AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Off-Topic (https://forums.alliedmods.net/forumdisplay.php?f=15)
-   -   C# (https://forums.alliedmods.net/showthread.php?t=321216)

Heks365 01-30-2020 12:40

C#
 
Hello, I need some help with making a quick program for a friend of mine.
What i need help with is this:

I am Using Visual Studio, and now i have a ComboBox that shows some Vehicles (in the Combobox area)

Now i want it to display a Picture of that car when i select it (by arrows or by mouse)

So kinda

If Combobox(text) == ("V70");
{
pictureBox1.Image = Image.FromFile("../pics/V70.jpg");
}
Else if Combobox(text) == ("740");
{
pictureBox1.Image = Image.FromFile("../pics/740.jpg");
}

I know this dont work but i hope you guys understand what i want to do with this :oops:
I Surely do appreciate all help and tips :) (Beginner in this kinda stuff so :)
Greetings Heks365

thEsp 01-30-2020 15:04

Re: C#
 
Code:

if (CB.Items[CB.SelectedIndex] == "...")
{
    // ...
}
else if (CB.Items[CB.SelectedIndex] == "...2")
{
  // ...
}

I think it should be like this called on ComboBox.OnSelectedIndexChanged, haven't worked in C# for some good months?

Heks365 01-31-2020 09:50

Re: C#
 
This didnt work for me. Is there another way

thEsp 01-31-2020 10:18

Re: C#
 
You could try better, couldn't you? :)
https://i.imgur.com/8NIjdse.png


All times are GMT -4. The time now is 00:19.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.