Hello, i don't know if i make things wrong:
Iconpanel on a Form, Panel on the Iconpanel, then a Tabstrip on the Panel and then Textfields on the Tabstrip. I Iterate over all controls do change the text in the Textbox.
Only visible Tabs will change the Text, all other dont change the Text...
To solve this, i have to insert the textfields in a panel and iterate every control in the panel, inside the Tabs.
(Sorry for my english..)
Thanks
Iterating Controls on Tabstrip
Iterating Controls on Tabstrip
- Attachments
-
- Example.tar.gz
- (13.12 KiB) Downloaded 360 times
- cogier
- Site Admin
- Posts: 1157
- Joined: Wednesday 21st September 2016 2:22pm
- Location: Guernsey, Channel Islands
Re: Iterating Controls on Tabstrip
If I understand you correctly, you could give all the TextBoxes the same Action name: -
Then delete all your code and replace with:-
Let us know if I have not understood you correctly.
Then delete all your code and replace with:-
Public Sub Button1_Click()
Action["AllTBs"].Text = "OK"
End
Let us know if I have not understood you correctly.
Re: Iterating Controls on Tabstrip
Thanks, but this was only a example to show this. I update Database Fields with this system...
Public Sub SaveData(MyObject As Object, sTable As String, sID As String, Optional sSql As String = "")
Application.Busy = 1
Dim Res As Result
Dim ctrl As Control
If sid <> "" Then
'Edit
Try res = db.Edit(sTable, "id ='" & sid & "'")
For Each ctrl In MyObject.Children
Select Case Object.Type(ctrl)
Case "TextBox"
If ctrl.Tag <> "id"
res[ctrl.Tag] = TextBox(ctrl).text
End If
Case "ComboBox"
res[ctrl.Tag] = ComboBox(ctrl).text
Case "ComboSeek"
res[ctrl.Tag] = ComboSeek(ctrl).text
Case "CheckBox"
res[ctrl.Tag] = CheckBox(ctrl).value
Case "DateBox"
res[ctrl.tag] = DateBox(ctrl).value
Case "ValueBox"
res[ctrl.Tag] = ValueBox(ctrl).value
Case "TextArea"
res[ctrl.Tag] = TextArea(ctrl).text
' Case "TabStrip"
' SaveDataSubdetail(ctrl, ByRef Res)
End Select
Next
'Save
res.Update
Else
- BruceSteers
- Posts: 1790
- Joined: Thursday 23rd July 2020 5:20pm
- Location: Isle of Wight
- Contact:
Re: Iterating Controls on Tabstrip
Try making ctrl an Object not Control with your For loop
I do not know of this TextBox(ctrl).Text syntax you are using?
like this...
See i use ctrl as Object , this means things like ctrl.Text become usable as Object can be anything and ANY property name can be used and accessed if it exists , but Control.class is limited to only use native Control.class properties that does not have .Text, .Value, etc.
I do not know of this TextBox(ctrl).Text syntax you are using?
like this...
Dim ctrl As Object ' Use Object here not Control
If sid <> "" Then
'Edit
Try res = db.Edit(sTable, "id ='" & sid & "'")
For Each ctrl In MyObject.Children
Select Case Object.Type(ctrl)
Case "TextBox"
If ctrl.Tag <> "id"
res[ctrl.Tag] = ctrl.text
End If
Case "ComboBox"
res[ctrl.Tag] = ctrl.text
Case "ComboSeek"
res[ctrl.Tag] = ctrl.text
Case "CheckBox"
res[ctrl.Tag] = ctrl.value
Case "DateBox"
res[ctrl.tag] = ctrl.value
Case "ValueBox"
res[ctrl.Tag] = ctrl.value
Case "TextArea"
res[ctrl.Tag] = ctrl.text
' Case "TabStrip"
' SaveDataSubdetail(ctrl, ByRef Res)
End Select
Next
See i use ctrl as Object , this means things like ctrl.Text become usable as Object can be anything and ANY property name can be used and accessed if it exists , but Control.class is limited to only use native Control.class properties that does not have .Text, .Value, etc.
If at first you don't succeed , try doing something differently.
BruceS
BruceS
Re: Iterating Controls on Tabstrip
Thanks, i changed....