Hello,
Thanks to everyone who is kind enough to answer... Is there any way to load data into controls of a form by a For loop What i mean is: if i have 10 labels, can i load texts from a string array of 10, each string from the array to a corresponding label, by a loop
Thank You

Loading controls with For loop
SpaceDog
If you don't want to create the control dynamically.
Name each label as
dynlabel0
dynlabel1
dynlabel2
...
In you load
Dim ctrl As Control
For Each ctrl In Controls
If ctrl.Name.StartWith("dynlabel") Then
''** ctrl is your label, you coud do Interger.Parse(ctrl.Name.Remove("dynlabel")) to get the ID
End If
Next
(This was written in a text file, there might be compilation error)
Inray
public void loopThoseLabels(string[] arrayOfLabels)
//emoticons/emotion-55.gif" alt="Idea" /> ;
{
for (int i = 0; i < arrayOfLabels.Length; i ++)
{
System.Windows.Forms.Label newLabel = System.Windows.Forms.Label() ;
newLabel.Text = arrayOfLabels
}
}
Colin Osbaldeston
You can either create the labels dynamically depending on how many you are going to need, or assign them at runtime to pre-existing examples.
Dynamically it would look something like this:
public void loopThoseLabels(string[] arrayOfLabels)
//emoticons/emotion-55.gif" alt="Idea" />;
{
for (int i = 0; i < arrayOfLabels.Length; i ++)
{
System.Windows.Forms.Label newLabel = System.Windows.Forms.Label();
newLabel.Text = arrayOfLabels
}
}
You would need to position the labels yourself, using the top and left properties.
All the best!
psygone13