3
I am involved in a personal project in which I intend to elaborate a calculator with some items that are inserted in "arrays". I opted for a class called "Calc.Cs" to build a method with a code identical to this one
public void AddDrinkstoTabbedpanel()
{
List<string> drinks = new List<string>();//New list empty
food foo = new food();//Call food to get drinks
string [] product = foo.name;//string product [] = food.name (drinks)
foreach (string value in product)//(string value in product)//for any "value" in product
{
drinks.Add(value);//Add these value to list
Button bt = new Button();//new button(s)
bt.Text = value.ToString();//Add text to button
}
}
I tried to get the "items" that are stored in "arrays" by inserting: Messagebox.Show(value);
and in fact get all the items I want.
However the solution does not create me for each item the respective button, why?
Where I failed, what’s wrong?
This is not a question of C#. What platform are you developing?
– Paulo Morgado