[Gambas-user] Set all fields(contol.value) on a panel to a default value?

Dag JNJ gambas at cd-bahia.com
Sat May 6 22:16:56 CEST 2023



Am 06.05.23 um 21:10 schrieb Dag JNJ:
>
>
> Am 06.05.23 um 19:46 schrieb Bruce Steers:
>>
>>
>> On Sat, 6 May 2023 at 18:07, Dag JNJ <gambas at cd-bahia.com> wrote:
>>
>>     Hi all,
>>     I am on a project with some SQL tables, similar GUIs with some
>>     fields on a normal panel. I make one function to clear all the
>>     fields the user can see. But I think I remember I saw a loop with
>>     /for each/ we´here the controls have been manipulated, e.g.
>>     change value.
>>
>>     I tried something like this
>>
>>     /Public Sub Sta_Adr_clearfields_bt_Click()//
>>     //
>>     //    Dim xtb As TextBox//
>>     //
>>     //    For Each xtb In Sta_Adr_data_pnl//
>>     //        xtb.Text = ""//
>>     //    Next//
>>     //End//
>>     /
>>     I get /Sta_Adr_data_pnl/ is not an enumeration (I had to
>>     translate from German by myself, hope that's the word).
>>     Either the syntax is wrong or I remember wrong.
>>
>>     Any help? Thanks in advance
>>     Dag
>>
>>
>> I assume /Sta_Adr_data_pnl//is a Panel/
>>
>> /So you need //Sta_Adr_data_pnl//.Children/
>> assuming ALL contents of /Sta_Adr_data_pnl//are textbox/
>> /
>> /
>> /BruceS/
> /Sta_Adr_data_pnl//.Children__/did//what I wanted. Now I only have to 
> figure out how to determine what kind of object.
> Thank you very much
>>
>> ----[http://gambaswiki.org/wiki/doc/netiquette  ]----
>
>
> ----[http://gambaswiki.org/wiki/doc/netiquette  ]----
This works as it should/
//Public Sub Sta_Adr_clearfields_bt_Click()//
//
//    Dim xtb As Variant//
//
//    For Each xtb In Sta_Adr_data_pnl.Children//
//        Select Case Object.Type(xtb)//
//            Case "TextBox"//
//                xtb.Text = ""//
//            Case "ValueBox"//
//                xtb.Value = "0"//
//        End Select//
//
//    Next/

Dag
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230506/1bbe7fc9/attachment-0001.htm>


More information about the User mailing list