Re: Is my Control a cotrol array ??

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



"Michael C" <nospam@xxxxxxxxxx> wrote in message
news:OcKoHbiUGHA.4740@xxxxxxxxxxxxxxxxxxxx
"Rick Rothstein" <rickNOSPAMnews@xxxxxxxxxxxxxxxxx> wrote in message
But you didn't point out any faults for nassos to use in making up
his mind; all you did is say that YOU THINK (you left those words
out) "This is one part of vb6 that really sucks". Personally, I
disagree with you on this. Control arrays are extremely easy to
create and work with... in my opinion, they don't suck at all. And
if you want to cite the problem this thread deals with, Bob posted a
solution that I myself have used in the past and which works quite
well and for which there is minimal (if any real) overhead
associated with it. So, what then is it that you think sucks about
control arrays, especially to the point of impelling you to post a
non-solution message to this thread?

"YOU THINK" is obvious implied because this is a newsgroup posting.
They suck for many reasons, the main one is a reference to a control
in a control array doesn't act like a reference to a normal control.

Sure it does. A reference to the control array itself doesn't act like a
reference to a normal control (nor should it) but a reference to a control
in a control array is a reference to a normal control.

The OP's problem is that a "normal" control doesn't expose any kind of
"InArray" property and raises an error if you try to access the Index
property. It might have been nice if VB had provided a more direct way of
querying that but what is there is very easy to work with.

Obviously it's not straight forward to check if a control is in an
array,

Depends on how you define straight forward; it's not obvious until you've
been shown the solution and learned to work with the control array object as
it is rather than how you might wish it to be.

an array can't contain different types of controls and it
can't be 2 dimensional.

A "control array" can't have different controls or be multi-dimensional but
an array of controls can and it takes very little work to create that if
needed.

I'm sure there's other problems as well which
I can't think of off the top of my head. As for a solution there
isn't one, you can't even use standard controls and create your own
array because you've got no way to trap the events.

The problem with event trapping is with the Controls.Add method, not control
arrays. That is poorly implemented in VB but even with that there are
solutions to creating arrays and getting event notifications.

The key is to learn the tool and make it work for you rather than crying in
the corner that it "sucks".

--
Reply to the group so all can participate
VB.Net: "Fool me once..."

.



Relevant Pages

  • Re: use counter value in referencing a variable
    ... > reference a form element by using a counter variable in the element's ... let's say I have a form with 10 textboxes named ... Creating control arrays in the future ... at runtime when you have a control array. ...
    (microsoft.public.vb.syntax)
  • Re: How to handle non-array arrayed controls by reference?
    ... So each label must be loaded and than some properties has to be set. ... Dim MyOLcontrol As Control ... individual label control from that control array or perhaps even a ... OL_controlload Shadow1 ...
    (microsoft.public.vb.controls)
  • Re: Is my Control a cotrol array ??
    ... is one part of vb6 that really sucks". ... Control arrays are extremely easy to create and work with... ... array doesn't act like a reference to a normal control. ...
    (microsoft.public.vb.controls)
  • Re: Internet Transfer Control array in a WebClass?
    ... The problem with creating the control array is that I need the WithEvents ... and VB won't allow me to instantiate the objects in an array with the ... I had already thought of setting up a wrapper class module, ...
    (microsoft.public.vb.controls.internet)
  • Re: Drawing on UserForms?
    ... > to a control array in VBA. ... > Control arrays are not supported in in VBA, ... > The labels not only have the properties/methods of a label, ...
    (microsoft.public.word.vba.userforms)