Maximum number of controls on .Net Windows Form?


Hal Gibson

What is maximum number of controls allowed on .Net
Windows Form?

I know it's 254 in VB6.

Roy Lawson

Why, are you coming close to the limit or just curios ?? :-

But you aren't the first person to think of this question
apparently. Some responses I found were one guy who added
512 buttons without any problems and another guy thought
the only limit now is on system resources.

Well, I just added 1080 buttons to my form (curiosity got
to me) and it took about 65 seconds to load in debug
mode. Granted I don't have a P4 3Ghz system here but I
wouldn't suggest it in an application :)

I am of the oppinion that system resources will become the
issue before any limit (if one exists) will.


Herfried K. Wagner [MVP]


Hal Gibson said:
What is maximum number of controls allowed on .Net
Windows Form?

I know it's 254 in VB6.

AFAIK there is no hard limitation. Nevertheless, I would not load more than
256 controls onto a form because the form will require a lot of memory.


Hi Hal,
We had a test with dynamicly removing controls some weeks ago.

Therefore Nak has made a test program, that with a randomizer puts about
5000 buttons and 5000 labels on a form.

I do'nt know which persons have used it to do the test, but I did not see
here any complains about that program.

I added something to make the amount of controls endless and I have stopped
that at 25000 (in debugger mode).

It took to much time to make this as normal behaviour.

ps. Maybe Nak has the program still downloadable.

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