[Gambas-user] Child control Index - Question.

Bruce Steers bsteers4 at gmail.com
Wed Feb 8 20:22:44 CET 2023


what type is your ControlElement variable?

BruceS


On Tue, 7 Feb 2023 at 23:26, Ian Roper <westozscribe at gmail.com> wrote:

> Hi ,
>
> I'm trying to track down a strange error: [Bad Index] when cycling through
> child controls of a container.
>
> I have a process that resets an input form prior to allowing new input (
> adding a new record)
>
> A simplified version of the routine is below.
>
>   For Each ControlElement In InControl.Children
>
>  If ControlElement Is TextBox Then Object.SetProperty(ControlElement,
> "Background", Color.White)
>     If ControlElement Is TextBox Then Object.SetProperty(ControlElement,
> "Text", EmptyString)    '<-----------<<< Error occurs here.
>     If ControlElement Is TextArea Then Object.SetProperty(ControlElement,
> "Text", EmptyString)
>     If ControlElement Is TextEditor Then
> Object.SetProperty(ControlElement, "Text", EmptyString)
>     If ControlElement Is ValueBox Then Object.SetProperty(ControlElement,
> "Value", Null)
>     If ControlElement Is CheckBox Then Object.SetProperty(ControlElement,
> "Value", 0)
>
> Next
>
> I used this same process on 40+ forms and there is only one form that
> causes an error.
>
> Many forms have multiple TextBox controls.
>
> I have deleted and recreated the control on the form - same error.
>
> The input container is a standard Panel.
>
> If I comment out the one line that causes the error, then everything works
> as required.
>
>
> What does the  bad '*Index*' refer to ? I am assuming it is the 'Symbol'
> column of the attached image.
>
> Cheers,
>
> Ian.
>
>
>
>
>
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230208/78eb893a/attachment.htm>


More information about the User mailing list