PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK

  • Reason
  • Tip
  • Example
  • Using a control and a local variable with the same name
Products
WINDEVWEBDEV - Server codeWEBDEV - Browser codeWINDEV MobileReports and Queries
Platforms
WindowsLinuxWindows MobileUniversal Windows 10 AppAndroidAndroid Widget iPhone/iPadApple Watch
Languages
JavaPHPAjaxUser code (UMC)External language
Databases
HFSQLHFSQL Client/ServerStored proceduresOLE DBODBCNative Accesses
Information 302: Ambiguity between a variable and a control
Reason
The same name was given to a control and to a local variable. In the current code, this name will represent the variable.
Tip
To avoid any ambiguity, we recommend that you use different names for your controls, windows and variables.
Example

Using a control and a local variable with the same name

Code triggering the message
The window contains an Edit1 control and a Button1 button. In the click code of the button, Edit1 is redefined and it corresponds to a Boolean variable.
// -- Click on button1

Edit1 is boolean = True


Possible correction
The code line can be kept as is or, if Edit1 corresponds to 2 different elements, the Edit1 variable can be renamed. This rename operation avoids confusion.
Minimum version required
  • Version 0
This page is also available for…
Comments
Click [Add] to post a comment