From: Dave O. on

"kpg" <ipost(a)thereforeiam> wrote in message
news:Xns9D8C5465C59F9ipostthereforeiam(a)207.46.248.16...
> Karl E. Peterson <karl(a)exmvps.org> wrote in
> news:uGzox9pALHA.980(a)TK2MSFTNGP04.phx.gbl:
>
>> Do you really have projects with so many controls, you're not sure if
>> some of them are even used?
>
> I knew someone would ask this question, and the answer is...Yes.
>
> I have a legacy app (ah, the absolution that comes when I say 'legacy')
> that has the maximum amount of controls, that is, the vb6 ide will not
> allow me to add any more. I really don't know what that number is
> (32767?)
> but I am there.

You do realize that an array of controls counts as a single control?
To make "space" for more controls put all the lines into a array of lines,
in your code search for line1 replace with line(0) and line2 to line(1) etc.
you can do the same for any control but it's best to start with the ones
that don't have any events (lines, shapes & labels)
Control arrays do not have to be contiguous so you could use the same
numbers as the lines may already have.

Dave O.


From: kpg on
"Dave O." <nobody(a)nowhere.com> wrote in
news:edB45XyALHA.5476(a)TK2MSFTNGP06.phx.gbl:

> You do realize that an array of controls counts as a single control?

I'm not sure I do know that. I ran into this limit some years ago and I
deleted some cosmetic shapes, and I recall consolidating some controls into
control arrays but I had the impression that it did not reduce the 'limit'
enforced by the IDE - but it makes sense that it would.

> To make "space" for more controls put all the lines into a array of
> lines, in your code search for line1 replace with line(0) and line2 to
> line(1) etc. you can do the same for any control but it's best to
> start with the ones that don't have any events (lines, shapes &
> labels) Control arrays do not have to be contiguous so you could use
> the same numbers as the lines may already have.

Good ideas. Many of the lines have the same name becuase they have
different parent controls, so I would need to change their parent at run
time.


From: kpg on
Here is how 3 controls in a control array are recorded in a form. This
seem to take up as much space as 3 non-array controls.

I think I also ran into the problem with dynamically creating control in an
array - even at run time you cannot exceed the imposed limit.

Begin VB.TextBox Text1
Height = 495
Index = 2
Left = 2280
TabIndex = 2
Text = "Text1"
Top = 2160
Width = 1215
End
Begin VB.TextBox Text1
Height = 495
Index = 1
Left = 1560
TabIndex = 1
Text = "Text1"
Top = 1440
Width = 1215
End
Begin VB.TextBox Text1
Height = 495
Index = 0
Left = 960
TabIndex = 0
Text = "Text1"
Top = 720
Width = 1215
End
From: Bob Butler on

"kpg" <ipost(a)thereforeiam> wrote in message
news:Xns9D8C724059F9Cipostthereforeiam(a)207.46.248.16...
> Here is how 3 controls in a control array are recorded in a form. This
> seem to take up as much space as 3 non-array controls.
>
> I think I also ran into the problem with dynamically creating control in
> an
> array - even at run time you cannot exceed the imposed limit.
>
> Begin VB.TextBox Text1
> Height = 495
> Index = 2
> Left = 2280
> TabIndex = 2
> Text = "Text1"
> Top = 2160
> Width = 1215
> End
> Begin VB.TextBox Text1
> Height = 495
> Index = 1
> Left = 1560
> TabIndex = 1
> Text = "Text1"
> Top = 1440
> Width = 1215
> End
> Begin VB.TextBox Text1
> Height = 495
> Index = 0
> Left = 960
> TabIndex = 0
> Text = "Text1"
> Top = 720
> Width = 1215
> End

There is a limit of 255 control names; control arrays created at design time
will take the same amount of "space" in the source files as ones not in
control arrays but they only count as 1 towards the limit. If you are
really saying that the total number of controls is reaching 32K then I'm
surprised it ever finishes loading.

You can eliminate line and label controls, and possibly others, by just
drawing on the form directly. You could also consider moving some blocks of
controls into user controls to isolate them from the form.

From: Karl E. Peterson on
kpg wrote:
> Every control on the form is configured and moved at run time, so I'm safe
> to assume that if a control is not touched in code it is no longer used,
> hence my desire for a dead control sweep.

OMG! I had no idea it could be *that* dire. I figured you meant
controls that were /truly/ unused. As in, not even placed on any
forms, just hanging out in the toolbox.

I'd be looking at rebuilding the entire UI at this point, if I were
called in on this one.

--
..NET: It's About Trust! http://vfred.mvps.org
Customer Hatred Knows No Bounds at MSFT
ClassicVB Users Regroup! comp.lang.basic.visual.misc
Free usenet access at http://www.eternal-september.org


First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4
Prev: 7-bit and News Servers
Next: Eternal September Rocks!