generate textboxes dynamically

G

Guest

Hi,

I've a textbox called MyTextBox in my form and I would like to generate 10
other textboxes dynamically as an instance of Mytexbox that have the same
events and properties.
how can I do it
 
J

Just Me

Erm, well lets first get something straight. Your 'MyTextBox' is an
Instance of TextBox. You cannot derive from an instance of a class only
from the class itself.

In order to acheive what you are looking for you would have to create a
class which inherits from TextBox and set the properties as you want them
during constrcution. And then instantiate from that.

As far as events are concerned, if you want all the text boxes to "Share"
the same event handlers, this can be added programatically using the
AddEvent Handler.

Perhaps it would server a better purpose to explain exactly what you are
trying to acheive and why. This will ellicit a more intelligent response.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top