Android Question label error

Peekay

Active Member
Licensed User
Longtime User
I have a label named lblMessage, which is the only label by that name in my app.
I did not know that labels can be made into an array or collection with different indexes (indices), and the properties of the label view does not show index as a property.

The code line with the error is:
Code line:
lblMessage.Text = "Enter the registration code"

The error I Get is:
Index was out of range. Must be non negative and less than the size of the collection. Parameter name: Index

PK
 

JohnC

Expert
Licensed User
Longtime User
Try deleting that label and re-adding it.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Do you have any empty module in your project? If so, remove it.
 
Upvote 0

Peekay

Active Member
Licensed User
Longtime User
Thanks guys,

When I completed the 'if .. end if' construct , this error disappeared.
I do not why it gave it. It has nothing to do with the construct.
I take note of the two good tips by JohnC and DonManfred.

PK
 
Upvote 0
Top