Hi!
I need to alter a variable name.
The scenario is: i have a lot of text box, so i want to read the text of each box and load all in a same string.
So, i think to use a for loop... but... if i work in this way, it's necessary alter the name of text box...
Can anybody help me

altering variable name
B123456H
Thanks,
Ayman Shoukry
VC++ Team
Shelto
You should also state what technologies you are using.
For Example, ATL, WTL, MFC, VC++.NET, Win32 API, etc.
GeoffChambers
But i'll try to explain better...
I have 10 textboxes, and i need to read the text of each one. How can i do this efficiently
Ronaldo444
Marco H
I'm using vc++ .net.
Many thanks!
kolya
txtBox.Name = "Bleah"
the variable name is txtBox and is referenced as txtBox. You don't even need to give textboxs names but you could easily do put the textboxe controls in an array and loop over the array getting the values. Your english/description of the problem were not very detailed or coherent so I cannot really elaborate much further as I have no idea what technologies you are actually trying to work with.
MartinPare
with your other control declarations so it is accessible throughout the whole form
TextBox[] MyTextBoxes = new TextBox[] { };
somewhere in your Code
MyTextBoxes = new TextBox[10];
for (Int32 i=0; i<MyTextBoxes.Length; i++)
{
MyTextBoxes[ i ] = new TextBox();
MyTextBoxes[ i ].Location = new Point(10, i*20);
Controls.Add(MyTextBoxes[ i ]);
}
in another part of your form
String Values = "":
for (Int32 i=0; i<MyTextBoxes.Length; i++)
{
Values += MyTextBoxes[ i ].Text + ", ";
}
MessageBox.Show(Values);