Textbox

Textbox
You can add a textbox to the web page with the **Textbox** statement. In addition to assigning a handle, you assign the text that appears initially in the textbox. Use an empty string for the text if the textbox should be empty.

Syntax:

TEXTBOX #handle, expr - Add a textbox to the web page with #handle and filled with the result of expr (string or numeric)

Usage:

code format="vbnet" 'create a textbox containing text textbox #t1, "Hello, World!"

'create a textbox with no text textbox #t2, ""

'create a textbox with numeric content textbox #t3, 5 code


 * TEXTBOX methods**


 * 1) handle CONTENTS$ //- Return the contents of the textbox as a string//
 * 2) handle VALUE //- Return the contents of the textbox as a number//
 * 3) handle TEXT(expr$) //- Set the contents of the textbox//
 * 4) handle PRINT(expr$) //- Append expr$ to the contents of the textbox//
 * 5) handle SETFOCUS //- Set the input focus to this control when the page is displayed//
 * 6) handle ISNULL //- Returns zero (or false)//
 * 7) handle DEBUG$ //- Returns the string "Textbox"//

The demo below creates three textboxes. The first textbox initially contains text. The second textbox is empty when it is created. The third textbox contains a number when it is created. Contents are retrieved as both a string value with **Contents$** and a numeric value with **Value**. Text is displayed replacing existing text in a textbox with **Text** and text is appended to existing text in a textbox with **Print** **Setfocus** is used to set the input focus to the first textbox.

code format="vbnet" 'create a textbox containing text textbox #t1, "Hello, World!" 'create a textbox with no text textbox #t2, "" 'create a textbox with numeric content textbox #t3, 5 'retrieve contents of box 1 as string var$ = #t1 contents$ print:print "Contents of box 1 is: ";var$; 'retrieve the contents of box 3 as number num = #t3 value print:print "Contents of box 3 is ";num 'replace text in box 1 'append text to box 3
 * 1) t1 text("New Text.")
 * 1) t3 print(" Added Text.")

'setfocus to box 1 code
 * 1) t1 setfocus

The code below demonstrates the **Debug$** and **IsNull** methods.

code print "Before creation, IsNull returns:" print #t isnull textbox #t, "" print print "Object is a ";#t debug$ print "After creation, IsNull returns:" print #t isnull wait code