Referring controls with $variables
Posted
#1
(In Topic #560)
Regular

I placed a textbox control in the main form. The Tag of the textbox gets the name of another control in the same form.
→ TextBox.Tag="DataComboView1"
When I try the following commands the compiler throws an error:
→ Print Me(TextBox.Tag).Table
→ Print ("DataComboView1").Table
Any idea how to refer to a control when I just have the name of a control in a string variable?
I know that MS-Acces supports it, e.g. Me($var).visible = True.
Posted
Regular

→ FMain.Controls["DataComboView1"].Table
Obviously Me doesn't support this.
Posted
Guru

01McAc said
Just found by chance on the internet https://lists.gambas-b…2016-February/056722.html the answer. The correct command is:
→ FMain.Controls["DataComboView1"].Table
Obviously Me doesn't support this.
Me just stands for the class or module file in use
for a normal Form (FMain) it refers to the form and class file of the same name.
so Me.Controls["DataComboView1"].Table would work.
the IDE gives great clues as you type.
Pressing a bracket after your object Ie . FMain.Controls( would show nothing , but using an angle bracket [ will show there are options using the angle brackets.
you can skip a whole lot of searching for answers just by trying different combinations of brackets ( , angle brackets [ , full stops . and seeing what gives you options and what options you get
Bruce
1 guest and 0 members have just viewed this.


