Runtime Error 0

  1. last week

    Hi everybody!
    The Xojo debugger shows me an error message (actually it doesn't show any) which I don't understand.

    The iOS project has

    • 2 classes: TeamClass & TeamStatsClass
    • Both classes have Integer properties (for example: Attempts)
    • 2 properties: Team(2) As TeamClass & TeamStats(2) As TeamStatsClass

    I have no problem with the TeamClass and I can assign values to its properties without any issues.
    As soon as I try to assign a value to a property from the TeamStatsClass it doesn't work. I am doing it like this:
    TeamStats(1).Attempts = 0

    During runtime, the debugger stops. The ErrorNumber is 0 and the Reason is "" (blank).

    Has anybody encountered this before or has an idea how to fix this?

    Thank you
    Christoph

    Yes. You are only declaring a place to hold the instances. You need to do a

    TeamStats(0)= new TeamStats()
    TeamStats(1) = new TeamStats()

    To initialize the instances

  2. Paul L

    Jul 10 Xojo Inc http://docs.xojo.com

    Sounds like you could be getting a NilObjectException. Is TeamStats(1) Nil?

  3. I am not sure I understand this properly.

    If I do this

    Dim TeamStats(2) As TeamStatsClass

    is TeamStats(1) Nil then?

  4. Jason K

    Jul 10 Pre-Release Testers Answer

    Yes. You are only declaring a place to hold the instances. You need to do a

    TeamStats(0)= new TeamStats()
    TeamStats(1) = new TeamStats()

    To initialize the instances

  5. That did the trick, thank you Jason. It's strange though because the property Team(2) works fine without that.

or Sign Up to reply!