I have a slider with a maximum value of “9”. Every Value shall change the text of a Label.
I can only think of this method right now:
private void Slider_Scroll(object sender, EventArgs e)
{
if (Slider.Value == 0)
{
Label.Text = "Text1";
}
else if (Slider.Value == 1)
{
Label.Text = "Text2";
}
//...and so on...
}
Is there a method to do this in a shorter way?
You can use a
List<string>and index it withSlider.Value: