Thursday, July 15, 2010

dynamic variables


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

No comments:

Post a Comment