I’m using Visual Basic 2008EE and I have a problem with this loop:
If x = CType("new", Primitive) Then
TextWindow.Write("How many new users would you like to add? ")
k = TextWindow.ReadNumber()
For mt = 1 To k
NewUserEntry()
Next
and i get this error:
"type of 'mt' is ambigious because the loop bounds and the step clause do not convert to the same type"
I appreciate any help.
The return type of
ReadNumber(or more accurately, the type ofkvariable) is probably not anInteger. When the compiler wants to infer the type of themt, it fails sincek, which is specified as the loop bound has one type (probably something likeDouble) and the loop step (implicitly the integer constant 1) has the typeInteger. The compiler will not automatically assume the type ofmtsince the two don’t match.