[Gambas-user] Impossible to get the text property of a textbox in a for each enumeration

Marc Guillaume alarch at alarch.pw
Fri Sep 10 22:52:26 CEST 2021


Hello,
I am retrieving data from a mysql database in a gridview. I edit a line with a popup menu in a form which contains the data of the database. 
The data in the form are in textboxes associated with a label and all these couples label textbox are in a panel. 
To be able to detect if the user has modified a field I put the database value in textbox1.text and textbox1.tag and so on. 
When closing the form I want to check if the user has modified any fields. So I browse the children of the panel and if the child is a textbox I want to compare the text and tag values. If they are different then I will know that there has been a modification and I can alert the user. So I put this code in the closure processing. 

Public Sub btnCancel_Click()

  Dim iResponse As Integer
  Dim oChild As Control
  Dim bModif As Boolean = False

  For Each oChild In panIel1.Children 
    If oChild Is TextBox
      If oChild.text <> oChild.Tag
        bModif = True
      Endif
    Endif
  Next
  If bModif
    iResponse = Message.Warning( etc.

But while in the for each loop I get the value of the tag without any problem I have an error for the text property : 

"Unknown text symbol in the control class"

However when I select with the mouse oChild.text I can see the text
displayed. 

Where is my error? 

I use gambas 3.14.3 from ppa on Ubuntu 20.04. 

Thanks for any help

--
Marc



More information about the User mailing list