Why would you want to change the name? How would you access them next time? That way madness lies...
Set the Text is easy, just set the button.Text property.
Or, you could use the Tag property - it can take an instance of any object.
And if you want to run through a list of buttons, there are two things you want to do:
1) Check that you have enough buttons or you loop will run off the end of them (even if you fix the for loop syntax) if I type a long sentence.
2) Create an array or List of Buttons to hold them, and use an index into that collection. This way you do not need to use a name for each or change it.
"Lets say i would limit the number of words into 10..
I just want to change the name in the loop in runtime..
so that i could store the content of array..
item0.Text = sentenceWord[0];
item1.Text = sentenceWord[1];
the only thing that is changing is the number after the item name..
so that i could assign each of the toggle button a value text..
Is that not possible?"
Not really, no - instead, set them up as an array:
private Button[] items = new Button[10];
Then create them dynamically:
for (int i = 0; i < 10; i++)
{
Button b = new Button();
b.Text = "??";
items[i] = b;
Controls.Add(b);
}
You can them use them pretty much as you describe.
(You will probably want to set the Location, and add a Click handler to each in the loop as well)