VB Error: Array Names are Ambiguous - What Now?

  • Thread starter Thread starter zanazzi78
  • Start date Start date
  • Tags Tags
    Array Error
Click For Summary

Discussion Overview

The discussion revolves around a Visual Basic (VB) error related to ambiguous array names. Participants are exploring the reasons behind this error and seeking solutions to resolve it. The scope includes technical explanations and potential troubleshooting steps related to programming in VB.

Discussion Character

  • Technical explanation, Debate/contested

Main Points Raised

  • One participant reports an issue with VB indicating that array names are "ambiguous" and seeks clarification on how to resolve this.
  • Another participant requests further elaboration on the problem to better understand the context.
  • A participant mentions defining an array as spd(n,n) under 'Option Explicit' and questions why VB does not accept this definition.
  • It is suggested that the variable 'n' must be explicitly defined, as 'Option Explicit' requires all variables to have a defined type.
  • Another participant notes that typically, an array can only be dimensioned to fixed values or constants, and suggests using the 'ReDim' function for dynamic sizing.
  • A participant explains that an "ambiguous name detected" error can occur if there is a naming conflict with a sub, function, or variable that shares the same name as the array being defined.

Areas of Agreement / Disagreement

Participants express varying views on the causes of the ambiguous name error, with some suggesting it relates to variable definitions and others pointing to naming conflicts. The discussion remains unresolved regarding the best approach to address the issue.

Contextual Notes

Participants have not fully clarified the definitions or values of the variables involved, particularly 'n', which may affect the understanding of the problem. There is also a lack of consensus on the best practices for defining arrays in this context.

zanazzi78
Messages
115
Reaction score
1
To those who helped yesterday,again, thanks.

I have managed to resolve most of my problems, however, i have a new issue.

VB seemsto think that the names of my arrays are "ambiguous", WHY?

what do i need to do to resolve this new and fustrating problem?
 
Technology news on Phys.org
Can you elaborate?
 
In the optionexplict i`ve defined my array as spd(n,n)

Vb doesn`t like this and i don`t know why!
 
zanazzi78 said:
In the optionexplict i`ve defined my array as spd(n,n)
Vb doesn`t like this and i don`t know why!
Have you defined n?

'Option Explicit' means you must explictly define every variable with a type. If you merely say a(n,n) that's not explicit.

You first need 'Dim n as integer'.
 
Typically you can only dimension an array to either values (i.e. 4) or constants. If you have n defined as dim n as integer, it will (in my experience) kick the variable out. If you need to have it change size look at the redim function. Hope this helps
 
An "ambiguous name detected" error is caused by a sub, function, or some other variable or array having the same name as the one you are currently trying to define.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
Replies
7
Views
4K
  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 23 ·
Replies
23
Views
2K
  • · Replies 28 ·
Replies
28
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 11 ·
Replies
11
Views
13K
  • · Replies 6 ·
Replies
6
Views
4K
  • · Replies 31 ·
2
Replies
31
Views
3K