error CS0022: Wrong number of indices

DaveW

Active Member
Licensed User
Longtime User
I have some code that works fine in the IDE but gives errors when I try to compile. I can't see what is wrong - or really understand what the error means, can anyone help?

The error I get is:
error CS0022: Wrong number of indices in [], expected '1'

The code is:
sub globals
Public Type(GName,X,Y)CompSource

sub writefile
FileOpen(f,fname,cRandom)
bin.New1(f,False)

bin.WriteSingle(ArrayLen(CompSource()))
For i = 0 To ArrayLen(CompSource())-1
bin.WriteString(CompSource(i).GName) '<-- error here
bin.WriteSingle(CompSource(i).X)
bin.WriteSingle(CompSource(i).Y)
Next
 

wolfgang

Member
Licensed User
Longtime User
Hi,
I think this should work:
B4X:
Public Type(GName,X,Y)CompSource[B](0)[/B]
 

DaveW

Active Member
Licensed User
Longtime User
Hi Erel,

yes, later it gets dimmed as an array. It's probably logical that I should have dimmed it as such in the global sub but the IDE never complained and it worked fine so I never thought about it again.

David.
 
Top