<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>An alternative approach, which is particularly useful if the
labels are dynamically placed on the form, would be to use a
global array of labels:</p>
<p>In the globals area of the form class:</p>
<p> Private theArrayOfLabels as Collection</p>
<p>In the form setup method (say form_open):</p>
<p> theArrayOfLabels = New Label[]<br>
Dim lbl as Label<br>
</p>
<p> For each index as Integer = 0 to 199<br>
lbl = new Label(parent) 'parent could be Me or some other
container<br>
'code to setup the new label (initial text, font,
foreground, width etc)<br>
'you don't need to set the name<br>
theArrayOfLabels.Add(lbl)<br>
Next</p>
<p>Finally where you reset the label text:</p>
<p> theArrayofLabels[index].Text = "new text"</p>
<p>Instead of an array of labels, you could use a collection of
labels, with the key being the individual label's name.<br>
</p>
<p><br>
<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">On 2020-09-06 10:58 a.m., pinglix via
User wrote:<br>
</div>
<blockquote type="cite"
cite="mid:585740579.976157.1599407908680@mail1.libero.it">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<p class="default-style">Hi,<br>
</p>
<p class="default-style">I have 200 Label components on a form
with name Label1, Label2 .... Label200 and I need to change the
Text property of one of them through an integer index.<br>
</p>
<p class="default-style"><br>
</p>
<p class="default-style">What is the best way to do it ?<br>
</p>
<p class="default-style">I cannot find a Find() method by name
that returns a reference to the correct object.<br>
</p>
<p class="default-style">I can set them to the same Group but then
what can I do with it ?<br>
</p>
<p class="default-style"><br>
</p>
<p class="default-style">Thanks,<br>
</p>
<p class="default-style">Paolo<br>
</p>
<p class="default-style"><br>
</p>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">
----[ <a class="moz-txt-link-freetext" href="http://gambaswiki.org/wiki/doc/netiquette">http://gambaswiki.org/wiki/doc/netiquette</a> ]----
</pre>
</blockquote>
</body>
</html>