English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Ok. I have VB 2003, but i need some help. When i try to code the program after i designed it and eveything, sometimes, it says that
it is not declared. For Example: label1.text. I followed the videos on Youtube, but on mine, there are squiggly marks under some words. What am i doing wrong? What can i do to correct it?

2007-07-08 19:49:46 · 3 answers · asked by shilong x 1 in Computers & Internet Programming & Design

3 answers

The squiggly line means that VB doesn't reconize it.

"It is not declared" VB is telling you that the item in question has not been defined (declared). VB has no idea what it is that you typed. This error is done by default when VB has been configured for OPTION EXPLICIT.

OPTION EXPLICIT tells VB that every object / variable must be declared and does not allow VB to automatically dimension a variable or proceedure.

You can get this error by misspelling a variable or object name OR using an object(control) without placing that control on the form.

For example :

Dim STATIC X as Integer
X = 0

X = Z + 1 ' You intend X+1 but Z has not been declared and is a typo. An error results if OPTION EXPLICIT is set


If OPTION EXPLICIT is not set then VB would be allowed to automatically dimention a variable called Z. This would result in a logic error as the about counter could give bogus results as Z is nerver reset to zero as intended by X=0 . Nor will the X=Z+1 function properly as a counter.

With OPTION EXPLICIT set the IDE is telling you that it doesn't reconize the variable Z and requires you to declare it before it will compile. This allows you to catch syntax errors which otherwise would not be caught.

So if you are using a default control name like Label1 and you are getting a squggly line VB doesn't reconize it. You either have not placed the control on the form (or it has been renamed) OR you are attempting to use a method or property which doesn't exist (misspelled maybe) or incorrectly identified

Label1.Caption vs Label1.text

A common misteak is to not include proper spacing with equal signs. The compilier cannot properly parse the command and thinks you are trying to declare another variable or use an undeclared command

Label1.text="your string here" 'The compilier think this is a proceedure called Label1.text="your string here" ()
which doesn't exist obviously

Try retyping the code with a space on either side of the equal sign
Label1.text = "your string here"

2007-07-09 00:54:25 · answer #1 · answered by MarkG 7 · 0 0

if you are declaring you have to specify its string r number like that,bz thzts a variable

ex: label1.text="My Name" like this you have to declare.

2007-07-08 20:55:19 · answer #2 · answered by Anonymous · 0 0

you are able to no longer do this calculation = onenumber sign twonumber you need to use an if or a swap to evaluate the sign and problematic code the sum as in calculation = onenumber * twonumber or calculation = onenumber - twonumber have relaxing.

2016-10-20 09:24:34 · answer #3 · answered by ? 4 · 0 0

fedest.com, questions and answers