问题描述
我知道命名控件的限制是 254,除此之外您必须使用控件数组.但似乎我们也达到了数组的限制.知道那个绝对限制是什么吗?
I know the limit for named controls is 254, beyond that you have to use control arrays. But it seems we have hit the limit for arrays too. Any idea what that absolute limit is?
推荐答案
没有绝对限制.如果在窗体上放置足够多的控件,最终会耗尽内存.我制作了一个将命令按钮加载到控件数组中的测试应用程序.我的第一次运行在大约 6900 个按钮处因内存不足"错误而停止.我关闭了一些其他应用程序,能够加载近 8200.我对文本框做了同样的事情,得到了不同的结果(大约 7300 之前和 8600 之后).不同的控件消耗不同的内存量,因此实际上无法指定可以放在表单上的确切控件数量.
There is no absolute limit. If you put enough controls on the form, you'll eventually run out of memory. I made a test app that loads command buttons into a control array. My first run stopped with an "Out of memory" error at around 6900 buttons. I shut down a few other apps and was able to load nearly 8200. I did the same thing with text boxes and got different results (about 7300 before and 8600 after). Different controls consume different amounts of memory, so there really is no way to specify an exact number of controls that you can put on a form.
这篇关于VB 6:一个窗体上可以有多少个控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!