Caner Bulut – R & D notes

Handle an object as variable in a loop with programatically, VB.Net

Posted in Uncategorized by canerblt on July 11, 2011

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 Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.