EDIT$ Returns "Invalid Function Call" in Nonactive Window (45894)






This article was previously published under Q45894

SUMMARY

The EDIT$ function gives an "Invalid Function Call" (error 5) in Microsoft QuickBASIC Version 1.00 for the Apple Macintosh when trying to retrieve the contents of an EDIT FIELD that is not in the active window.

MORE INFORMATION

The EDIT$ function can be used to return the current contents of an edit field only within the active window. You must first make the EDIT FIELD's window active before invoking EDIT$. The syntax is as follows, where fieldnumber is the number of the field that was previously defined with an EDIT FIELD statement:

EDIT$(fieldnumber)

The above statement returns the user's input for a specific field.

If you open a window, define EDIT FIELDs, receive input into these fields, change your active window, and try to retrieve the information in the previous EDIT FIELDs, you generate an "Invalid Function Call" (error 5).

For more information on the EDIT$ function and the EDIT FIELD statement, consult the "Microsoft QuickBASIC for Apple Macintosh: User's Guide," Pages 113-117.

Code Example

WINDOW 1, "Current EDIT Window",(50,50)-(320,160),1
EDIT FIELD 1,"",(5,10)-(250,100),1
WHILE MOUSE(0) = 0 : WEND
names$ = EDIT$(1)
WINDOW 2, "This is NOW the CURRENT window",(100,200)-(370,300),1
' This next line will generate an "Invalid Function Call"
names$ = EDIT$(1)
PRINT names$
WHILE MOUSE(0) = 0 : WEND
END
				

Modification Type: Minor Last Reviewed: 1/8/2003
Keywords: KB45894