Home / comp / gb.qt / textbox / .change 
TextBox.Change (gb.qt)
Syntax
EVENT Change ( )
Raised when the text of the control changes.

This event is raised for each letter which is typed in, and whenever the program writes to the Text property.

Example
PUBLIC SUB TextBox1_Change()

IF TextBox1.Text = "grey" THEN PictureBox1.BackColor = &H707070&

END

If you want to use this event to modify the Text in the same TextBox, then this event handler is raised again.

To prevent a stack overflow, use a Boolean semaphore to prevent a second entry when the event is raised by the event handler instead by manual input.

Example
PUBLIC bRefreshing AS Boolean

PUBLIC SUB TextBox1_Change()


IF bRefreshing THEN RETURN

bRefreshing = TRUE


IF TextBox1.Text = "gray" OR TextBox1.Text = "grey" THEN
  TextBox1.Text = "grey"                                  ' This refreshes the Text property
ENDIF
bRefreshing = FALSE
END