Friday, August 27, 2010

nombre de variables dinamicos

        Dim i As Integer
        Dim field As System.Reflection.FieldInfo
        Dim lblruc As Label
        For i = 1 To psComReg.Length()
            field = Me.GetType().GetField("lbl_5_" + i.ToString(), _
                System.Reflection.BindingFlags.NonPublic Or System.Reflection.BindingFlags.Instance)
            lblruc = DirectCast(field.GetValue(Me), Label)
            lblruc.Text = psComReg(i - 1)
        Next

No comments:

Post a Comment