<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../../../style.css">
<title>
Gambas Documentation - TextBox.Change
 (gb.qt)</title>
</head>
<body>
<table class="none" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td align="left">
<font size="-1">
<a href="../../../../help%3Fen"><img class="flag" alt="Home" border="0" src="../../../../img/lang/en.png" align="center"></a>&nbsp;&nbsp;
<a href="../textbox%3Fen">Up</a>&nbsp;&nbsp;
<a href="_activate%3Fen">Previous</a>&nbsp;&nbsp;
<a href="alignment%3Fen">Next</a>&nbsp;&nbsp;
</td></tr></table>
<div class="notab">
<h1>
TextBox.Change
 (gb.qt)</h1>
<div class="black"><font color="white" size="-2"><b>Syntax</b></font></div>
<pre class="syntax"><font color="blue">EVENT</font> <b>Change</b> <font color="blue">(</font> <font color="blue">)</font></pre>
Raised when the text of the control changes.
<p>
This event is raised for each letter which is typed in, and whenever the program writes to the Text property.
<p>
<div class="gray"><font color="white" size="-2"><b>Example</b></font></div>
<pre class="example">
PUBLIC SUB TextBox1_Change()

IF TextBox1.Text = &quot;grey&quot; THEN PictureBox1.BackColor = &H707070&

END</pre>
<p>
<div class="warning"><table class="none" border="0"><tr><td width="40" valign="top"><img border="0" src="../../../../img/warning.png" align="center"></td><td valign="top">
If you want to use this event to modify the Text in the same <a href="../textbox%3Fen">TextBox</a>,
then this event handler is raised again.
<p>
To prevent a stack overflow, use a <a href="../../../lang/type/boolean%3Fen">Boolean</a> semaphore to prevent
a second entry when the event is raised by the event handler instead by manual input.
<p>
<div class="gray"><font color="white" size="-2"><b>Example</b></font></div>
<pre class="example">
PUBLIC bRefreshing AS Boolean

PUBLIC SUB TextBox1_Change()


IF bRefreshing THEN RETURN

bRefreshing = TRUE


IF TextBox1.Text = &quot;gray&quot; OR TextBox1.Text = &quot;grey&quot; THEN
  TextBox1.Text = &quot;grey&quot;                                  ' This refreshes the Text property
ENDIF
bRefreshing = FALSE
END</pre>

</td></tr></table></div>

</div>
<hr>
</body>
</html>

