• After more than 30 years running websites and forums I am retiring.

    I have made many friends through the years. I will cherish my time getting to know you. I wish you all the best. This was not an easy decision to make. The cost to keep the communities running has gotten to the point where it's just too expensive. Security certificates, hosting cost, software renewals and everything else has increased threefold. While costs are up ad revenue is down. It's no longer viable to keep things running.

    All sites will be turned off on Thursday 30 November 2023. If you are interested in acquiring any of the websites I own you can Email Schwarz Network.

Creating an array of textboxes at runtime.


Jun 13, 2004
Hello All,

I have created an application that reads items from a database. What I want to do now is create an array of text boxes that are populated with the data retrieved from the database.

The problem is that I am unsure how to create an array of textboxes at runtime. I can use the .set_Size() method to place the box.

So far I have:

System.Windows.Forms.TextBox [] tbxResults = new TextBox[20];

while (myDataReader.Read())
	tbxResults[loopControl] = new TextBox();
	tbxResults[loopControl].set_Location(new System.Drawing.Point(8, y));
	loopControl ++;
	y += 24;

However the does not work.

Any help will be most appreciated
Harold Clements
Top Bottom