Handle an object as variable in a loop with programatically, VB.Net
If you have lots of textboxes or other objects in your project and you need to populate and control these objects programatically, use Controls property of form object to handle this.
An example,
While sa.Read
s = s + 1
Me.Controls(“e” & s).Text = sa.Item(1)
Me.Controls(“b” & s).Text = sa.Item(2)
Me.Controls(“x” & s).Text = sa.Item(3)
Me.Controls(“y” & s).Text = sa.Item(4)
End While
The names of textboxes created in the loop and then the values which is stored in the DB assigned textboxes’ .text properties.
Advertisement
leave a comment