Brian Hooper
Brian Hooper

Reputation: 22054

How to replace a Control Array with individual Controls?

A previous programmer has created a form with a control array, containing the following controls:-

Command1(0)
Command1(1)
Command1(2)

and I am attempting to replace them with

cmdMeaningfulName
cmdOtherMeaningfulName
cmdThirdMeaningfulName

So far I have managed to rename the controls. This leaves me, however, with a set of controls:-

cmdMeaningfulName(0)
cmdOtherMeaningfulName(1)
cmdThirdMeaningfulName(2)

I can fiddle with the Index properties to get:-

cmdMeaningfulName(0)
cmdOtherMeaningfulName(0)
cmdThirdMeaningfulName(0)

but this still leaves a control array, resulting in methods like

cmdMeaningfulName(Index As Integer)

being generated (or required). Later - these methods don't actually compile, being reported as

Member already exists in a object module from which this object module derives.

when it clearly doesn't.

How does one remove the index entirely? I have tried editing the .frm by hand and no trace of any index can be found there.

Upvotes: 1

Views: 137

Answers (1)

MarkL
MarkL

Reputation: 1771

On the form, select the control, then go to the properties window (F4). You can then select the index property and clear it. The control is then no longer an element of an array. This also means that any event handlers (_click, etc) are no longer hooked up, so you'll need to copy/re-implement those.

Upvotes: 7

Related Questions