You are here:

Visual Basic/Visual Basic (Programming)

Advertisement


Question
QUESTION: Would you mind helping me please?

Instructions: Determine if each of the following variable names is valid or invalid. Please state the error in the invalid names.

a. _intRadian
b. PercentOfSales#
c. first_Input_Value
d. R743-L56
e. 3CPO
f. Close
g. Name Of Client

ANSWER: Dear Dj,

Open project, go to the code window, type following for a.

Dim intRadian() As String

No error.

b.

Dim PercentOfSales#() As String

Compiler gives error - cannot use # in the variable name

c.

Dim first_Input_Value() As String

No errors

d.

Dim R743(-L56) As String

Error: L56 is not declared - you cannot use not declared variables to define another variable

e.

Dim 3CPO As String

Error - variable should not start with number

f.

Dim Close() As String

No errors, but it is not recommended to use word Close to define a variable because Close is normally used as a function (Method) name - function that normally closing the form for example.

g. Error - you cannot using several words to define variable - variable is always one word.

So the method to answer your question is to try to define it as variable using Dim statement. If there is something wrong with the name, you'll get compiler error.

Regards,

Vitaly

---------- FOLLOW-UP ----------

QUESTION: So is that the answer you gave me?

Answer
Dear Dj,

This is your assignment:

Determine if each of the following variable names is valid or invalid. Please state the error in the invalid names

I've analyzed each of your variables, explained you the errors, gave you the method to solve similar problems in the future - and instead of "Thank you" the only thing I'm getting form you is: "So is that the answer you gave me?"   

I'm volunteer here, spending my free time to help you - would you mind to be more polite?


Regards,

Vitaly

Visual Basic

All Answers


Answers by Expert:


Ask Experts

Volunteer


VITALY

Expertise

Area of expertise is Visual Basic .NET (VS 2008 and Framework 3.5) design and development for Windows applications. You can ask me any Visual Basic questions and some questions about .NET Framework. You can also ask me how to use Component One controls in Visual Basic. Do not ask me questions about Web design and development in Visual Basic.

Experience

I'm working as VB programmer from 1997, so I have a lot of experience with Visual Basic .NET as well as Visual Basic 6. Area of expertise is Visual Basic .NET (VS 2008 and Framework 3.5) design and development for Windows applications; Component One controls for Visual Basic; User controls; Moving VB6 applications to .NET.

Education/Credentials
B.S. in Computer Science

©2016 About.com. All rights reserved.