[Gambas-user] How do you deal with multiple objects (Textboxes)
Charlie Reinl
Karl.Reinl at ...2345...
Fri Dec 13 16:32:23 CET 2013
Am Freitag, den 13.12.2013, 05:47 -0800 schrieb Charlie:
> Hi Richard,
>
> Thanks for the reply. Here is the code I am using. I thought there must be a
> better way.
>
> Charlie.
>
> Public Sub ClearTable()
> QTY1.text = ""
> QTY2.text = ""
> QTY3.text = ""
> QTY4.text = ""
> QTY5.text = ""
> QTY6.text = ""
> QTY7.text = ""
> QTY8.text = ""
> QTY9.text = ""
> QTY10.text = ""
> WH1.text = ""
> WH2.text = ""
> WH3.text = ""
> WH4.text = ""
> WH5.text = ""
> WH6.text = ""
> WH7.text = ""
> WH8.text = ""
> WH9.text = ""
> WH10.text = ""
> PTNO1.text = ""
> PTNO2.text = ""
> PTNO3.text = ""
> PTNO4.text = ""
> PTNO5.text = ""
> PTNO6.text = ""
> PTNO7.text = ""
> PTNO8.text = ""
> PTNO9.text = ""
> PTNO10.text = ""
> BookInOut1.Hide
> BookInOut2.Hide
> BookInOut3.Hide
> BookInOut4.Hide
> BookInOut5.Hide
> BookInOut7.Hide
> BookInOut8.Hide
> BookInOut9.Hide
> BookInOut10.Hide
> Desc1.text = ""
> Desc2.text = ""
> Desc3.text = ""
> Desc4.text = ""
> Desc5.text = ""
> Desc6.text = ""
> Desc7.text = ""
> Desc9.text = ""
> Desc9.text = ""
> Desc10.text = ""
>
>
Salut Charlie,
if you have containers on your form, that should do the whole job.
changeEditControl(Me, TextBox1)
Public Sub changeEditControl(oObj As Object, ctrlCont As Control)
Dim myControl As String
Dim hClass As Control
Dim hCont As Container
Dim objMyOne As Object
myControl = Object.type(ctrlCont)
For Each hClass In oObj.Children
' is it like my ctrlCont ?
If Object.type(hClass) = myControl Then
objMyOne = hClass
objMyOne.Text = ""
objMyOne.Visible = False
Else
' TRY if it is a Container
Try hCont = hClass
If Not Error Then
' I call my self to find out if there are Children like my
ctrlCont
changeEditControl(hClass, ctrlCont)
Endif
Endif
Next
End
--
Amicalement
Charlie
More information about the User
mailing list