Announcement

Collapse
No announcement yet.

Perplexing Error # 9-subscript/pointer out of range

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Perplexing Error # 9-subscript/pointer out of range

    In my callback function
    Code:
    CALLBACK FUNCTION ShowDIALOG1Proc()
    with #DEBUG DISPLAY ON with the following code
    Code:
    label1:
      SELECT CASE AS LONG CB.MSG
        CASE %WM_INITDIALOG
    I get:
    Untrapped ERROR #9(Subscript/POINTER OUT OF RANGE) following lable1
    If I move the label a bit as so:
    Code:
    SELECT CASE AS LONG CB.MSG
        CASE %WM_INITDIALOG
      label1:
    I get:
    Untrapped ERROR #9(Subscript/POINTER OUT OF RANGE) following SHOWDIAL
    Anyone have any idea how those two lines would cause the problem?
    I have closed and reopened the IDE, restarted the computer but the error still keeps happening. I have placed labels throughout the code in all functions/subs
    Rod
    "To every unsung hero in the universe
    To those who roam the skies and those who roam the earth
    To all good men of reason may they never thirst " - from "Heaven Help the Devil" by G. Lightfoot

  • #2
    They don't. That's just the last label encountered before the error occurs. It could be a lot further down in your code

    Comment


    • #3
      Write a simple helper program which takes your program's source code as input and inserts a line number before each line.
      Then run that version and every line will have a label so you'll be able to see on which line the error really occurs.

      Comment


      • #4
        Right, the error occurs after label1 in the first example, so if I move the error down a wee bit, I should be able to advance on until I come to the error, but by moving the label 2 lines, it happens before the label so the error should be in one of those two lines. In the following it never gets to label2.
        Code:
        label1:
          SELECT CASE AS LONG CB.MSG
            CASE %WM_INITDIALOG
          label2:
        And in the following case the same error is thrown after label3 and before label2.
        Code:
        label1:
          SELECT CASE AS LONG CB.MSG
          label3:
            CASE %WM_INITDIALOG
          label2:
        Rod
        "To every unsung hero in the universe
        To those who roam the skies and those who roam the earth
        To all good men of reason may they never thirst " - from "Heaven Help the Devil" by G. Lightfoot

        Comment


        • #5
          I found the culprit by repeated clicking the OK option on the error message, and since it only happened 14 times and I only had 3 loops that size, further labels( similar to Paul's suggestion ) pinpointed the error that my other personality made.
          Thank you for giving the issue some thought.
          Rod
          "To every unsung hero in the universe
          To those who roam the skies and those who roam the earth
          To all good men of reason may they never thirst " - from "Heaven Help the Devil" by G. Lightfoot

          Comment

          Working...
          X