VB.NET dynamic use of form controls

Posted by Marcx on Stack Overflow See other posts from Stack Overflow or by Marcx
Published on 2010-03-07T10:50:13Z Indexed on 2010/04/10 14:03 UTC
Read the original article Hit count: 438

Filed under:
|
|
|

I have 10 labels named lbl1, lbl2, ... lbl10

I'd like to change their propriety (using a cicle) with the cicle index

for i as integer=1 to 10 step 1
    lbl (i) = PROPRETY 'I know this is wrong but it's what I would do...
end for

I'm using a workaround, but I'm looking for a better way..

    Dim exm(10) As Label
    exm(1)=lbl1
    exm(2)=lbl2
    ...
    exm(10)=lbl10

    for i as integer=1 to 10 step 1
        exm (i) = PROPRETY 
    end for

© Stack Overflow or respective owner

Related posts about .NET

Related posts about form