Error in Visual Basic VS 9

Asked By 10 points N/A Posted on -
qa-featured

Hello All!

I recently got an error while programming in VB. What does it mean when I get this error?

"Ambiguous name detected"

I already used another name but with different capitalization. I used the variables phonenumber and PhoneNumber. I thought VB was not a case sensitive programming language. 

How do I fix this problem?

SHARE
Best Answer by jackbrown
Answered By 0 points N/A #82987

Error in Visual Basic VS 9

qa-featured

First of all you must practice not to use same kind of names to define variables in any programming language. It’s very bad because it will be confusing to others who go through your code. This error is a compilation error message which conveys that similar words are used for create variables.

Since you have not stated much information about your application it’s difficult to find an exact solution. If you are using VB 2008 or VB 2010 the variables ‘phonenumber ‘and ‘PhoneNumber’ are considered as same. There is another issue with this error. If you have declared two variables as public variables with the same name and try to use only one variable in a form or module this error would be occurred.

Best Answer
Best Answer
Answered By 0 points N/A #82985

Error in Visual Basic VS 9

qa-featured

This error comes when you declare two functions or variables with the same name in V. B. You have used same name using different capitalization. As VB in not case sensitive it will take the entire variable as phone number as same and will great ambiguity for the compiler. You might have declared it two times and might have used it as the same. Just keep one variable as phone number and change the name for other variable.

It is same for functions also. You can't declare two functions with the same name. If you do then the second function overlaps the first function and thus this error occurs.

Login/Register to Answer

Related Questions