One quick thought,
You should Create a Function Like
-----------------------
    Private Function FindControl(ByVal ControlName As String) As Control
        Dim loopX As Integer
        For loopX = 0 To Me.Controls.Count
            If Me.Controls(loopX).Name.ToLower().Equals(ControlName.ToLower())
Then
                Return Me.Controls(loopX)
            End If
        Next
        Return Nothing
    End Function
---------------------------------
which fill find the control by given name,
Next

use your Code
-----------------------------
Sub Test2
   For i = 1 to 20
    FindControl(("Label" & i).Text = Array(i)
   'Label&i.text = Array(i)
   Next i
End Sub

I know there must be another slick way of doing this, but if nothing
else does the job for you, use the above.

Waqas...


On Fri, 09 Jul 2004 14:06:14 -0000, Skouperd
<[EMAIL PROTECTED]> wrote:
> Hi everybody, I have a problem and maybe somebody that is smart can
> advise me how to solve it.  I am using VB.net (2003) and the problem
> is something along the following lines.
> 
> Sub Test
>  Label1.Text = Array(1)
>  Label2.Text = Array(2)
>  Label3.Text = Array(3)
> ....
>  Label18.Text = Array(18)
>  Label19.Text = Array(19)
>  Label20.Text = Array(20)
> End Sub
> 
> Now I need to be able to write the code more or less as follows:
> 
> Sub Test2
>  For i = 1 to 20
>   Label&i.text = Array(i)
>  Next i
> End Sub
> 
> Now I have listed it EXTREMELY simply above but that is more or less
> what I need to do.  The problem I am having is with the &i (it is
> obviously wrong, but the systax is the one that I use in SAS)  Surely
> VB must be able to support something along the above lines?  Any
> assistance will be appreciated!
> 
> Adios
> Skouperd
> 
> 
> '// =======================================================
>     Rules : http://ReliableAnswers.com/List/Rules.asp
>     Home  : http://groups.yahoo.com/group/vbHelp/
>     =======================================================
>     Post  : [EMAIL PROTECTED]
>     Join  : [EMAIL PROTECTED]
>     Leave : [EMAIL PROTECTED]
> '// =======================================================
> 
> Yahoo! Groups Links
> 
> 
> 
> 
>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/k7folB/TM
--------------------------------------------------------------------~-> 


'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [EMAIL PROTECTED]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to