private void LineUpNumbers()
{
Array.Sort(lineArray[currentSelectedLine]); // Sorts the array in ascending order.
string numberBox = "Line" + (currentSelectedLine + 1).ToString() + "NumberBox";
string nb;
Image[] CircleColours = new Image[6] {Properties.Resources.BlueCircle, Properties.Resources.RedCircle , Properties.Resources.OrangeCircle , Properties.Resources.PurpleCircle , Properties.Resources.GreenCircle , Properties.Resources.YellowCircle};
Random r = new Random();
CircleColours = CircleColours.OrderBy(x => r.Next()).ToArray();
for (int i = 0; i <6; i++) // Populates NumberBoxes with the numbers from the array
{
nb = numberBox + (i + 1);
Line1.Controls[nb].Text = lineArray[currentSelectedLine][i].ToString();
Line1.Controls[nb].BackgroundImage = CircleColours[i];
}
}
Hallo, In dem obigen Schnipsel würde Ich mag Line1 zu ändern, um ein String-Variable zu sein, aber ich bin auf der richtigen Syntax nicht sicher, so zu tun . Könnte jemand mit einer Lösung dafür helfen? Dies ist C#C# GROUPBOX Lotto, die Hilfe benötigt, variable Zuordnung für Gruppenfeld
Line1 ist der Name der GrouBox. Ich möchte in der Lage sein, Line1 in eine Zeichenfolge zu ändern. Wie folgt aus:
string groupBoxName = "Line1";
groupBoxName.buttonName.BackgroundImage = CircleColours[i];
Der Code funktioniert nicht, obwohl