469,648 Members | 1,396 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,648 developers. It's quick & easy.

Creating TextBoxes Dynamically

In my previous posting I failed miserably, to give enough information to get
my difficulty apparent.

So to start again. I want to create textboxes dynamically in VB.NET. This
is not a web application that I'm trying to build. I should add that i am a
very new user to VB.NET and as such am very ignorant so please excuse this.

Many thanks for any assistance.

regards

Brian
Jul 21 '05 #1
2 9882
Hi Brian,

To create any kind of object dynamically you just call its constructor.

TextBox t = new TextBox();

This will create a TextBox object and store a reference to it in 't'.

Before you can see it you also need to add it to a container object, like
a windows form

Me.Controls.Add(t)

You should now be able to see a TextBox at the default position with
default size.

To create several TextBoxes, repeat the code above.
To keep track of the various TextBoxes you can set the TextBox.Name
property, store the references in various lists etc.
On Mon, 14 Feb 2005 04:15:02 -0800, Briand
<Br****@discussions.microsoft.com> wrote:
In my previous posting I failed miserably, to give enough information to
get
my difficulty apparent.

So to start again. I want to create textboxes dynamically in VB.NET.
This
is not a web application that I'm trying to build. I should add that i
am a
very new user to VB.NET and as such am very ignorant so please excuse
this.

Many thanks for any assistance.

regards

Brian


--
Happy Coding!
Morten Wennevik [C# MVP]
Jul 21 '05 #2
Hi Morten

Many thanks for the info, I'll give it a go

Brian

"Morten Wennevik" wrote:
Hi Brian,

To create any kind of object dynamically you just call its constructor.

TextBox t = new TextBox();

This will create a TextBox object and store a reference to it in 't'.

Before you can see it you also need to add it to a container object, like
a windows form

Me.Controls.Add(t)

You should now be able to see a TextBox at the default position with
default size.

To create several TextBoxes, repeat the code above.
To keep track of the various TextBoxes you can set the TextBox.Name
property, store the references in various lists etc.
On Mon, 14 Feb 2005 04:15:02 -0800, Briand
<Br****@discussions.microsoft.com> wrote:
In my previous posting I failed miserably, to give enough information to
get
my difficulty apparent.

So to start again. I want to create textboxes dynamically in VB.NET.
This
is not a web application that I'm trying to build. I should add that i
am a
very new user to VB.NET and as such am very ignorant so please excuse
this.

Many thanks for any assistance.

regards

Brian


--
Happy Coding!
Morten Wennevik [C# MVP]

Jul 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Bhavin | last post: by
2 posts views Thread by Briand | last post: by
5 posts views Thread by tshad | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.