Hello fellow DB Programers
I have just finished typing a long program code in and I am getting RunTime Error 118. This error says that Array does not exist or array subscript out of bounds at line 177. If someone could explain what this error means, and what I have to do to fix my code, that would be great.
Rem Project: VirtualKeyboard Program
Rem Created: Wednesday, February 22, 2012
Rem Designer: Andrew D. South
Rem ***** Main Source File *****
DIM KEY$(256)
DIM KEYX(256)
DIM KEYY(255)
` KEY STATE DATA
` #,KEY,XCORD,YCORD
DATA 1,"ESC",30,43
DATA 59,"F1",93,43
DATA 60,"F2",137,43
DATA 61,"F3",178,43
DATA 62,"F4",218,43
DATA 63,"F5",262,43
DATA 64,"F6",303,43
DATA 65,"F7",343,43
DATA 66,"F8",385,43
DATA 67,"F9",425,43
DATA 68,"F10",467,43
DATA 87,"F11",507,43
DATA 88,"F12",551,43
DATA 41,"`",26,92
DATA 2,"1",85,92
DATA 3,"2",126,92
DATA 4,"3",172,92
DATA 5,"4",210,92
DATA 6,"5",254,92
DATA 7,"6",297,92
DATA 8,"7",340,92
DATA 9,"8",383,92
DATA 10,"9",428,92
DATA 11,"0",469,92
DATA 12,"-",513,92
DATA 13,"=",555,92
DATA 14,"BACK",593,92
DATA 15,"TAB",26,130
DATA 16,"Q",85,130
DATA 17,"W",126,130
DATA 18,"E",172,130
DATA 19,"R",210,130
DATA 20,"T",254,130
DATA 21,"Y",297,130
DATA 22,"U",340,130
DATA 23,"I",383,130
DATA 24,"O",426,130
DATA 25,"P",469,130
DATA 26,"[",513,130
DATA 27,"]",555,130
DATA 43,"\",580,130
DATA 58,"CAPS",26,164
DATA 30,"A",85,164
DATA 31,"S",126,164
DATA 32,"D",172,164
DATA 33,"F",210,164
DATA 34,"G",254,164
DATA 35,"H",297,164
DATA 36,"J",340,164
DATA 37,"K",383,164
DATA 38,"A",426,164
DATA 39,"S",469,164
DATA 40,"D",513,164
DATA 28,"F",555,164
DATA 42,"LSHIFT",26,195
DATA 44,"Z",85,195
DATA 45,"X",126,195
DATA 46,"C",172,195
DATA 47,"V",210,195
DATA 48,"B",254,195
DATA 49,"N",297,195
DATA 50,"M",340,195
DATA 51,"<",383,195
DATA 52,">",426,195
DATA 53,"/",469,195
DATA 54,"RSHIFT",513,195
DATA 29,"LCTRL",48,240
DATA 219,"LWIN",120,240
DATA 56,"LALT",187,240
DATA 57,"SPACE",262,240
DATA 184,"RALT",335,240
DATA 220,"RWIN",404,240
DATA 221,"APP",475,240
DATA 157,"RCTRL",547,240
DATA 200,"UP",290,279
DATA 203,"LT",246,317
DATA 208,"DN",285,317
DATA 205,"RT",323,317
DATA 183,"SYSRC",0,0
DATA 70,"SCRLOCK",0,0
DATA 210,"INS",20,279
DATA 199,"HOME",71,279
DATA 201,"PGUP",125,315
`KEYPAD KEYS
DATA 69,"NUM",436,280
DATA 181,"/",486,280
DATA 55,"*",531,280
DATA 74,"-",574,280
DATA 71,"7",439,309
DATA 72,"8",489,309
DATA 73,"9",531,309
DATA 75,"4",436,340
DATA 76,"5",486,340
DATA 77,"6",531,340
DATA 78,"+",574,326
DATA 79,"1",436,368
DATA 80,"2",481,368
DATA 81,"2",531,368
DATA 82,"0",462,396
DATA 83,".",522,387
DATA 156,"E",574,382
DISABLE ESCAPEKEY
LOAD BITMAP "Media\keyboard.bmp",1
SET TEXT TRANSPARENT
SYNC ON
SYNC RATE 30
ReadKeyBoardData()
`SCAN FOR ALL THE KEYS BEING HIT
WHILE ESCAPEKEY()=0 OR RETURNKEY()=0
COPY BITMAP 1,0
SET TEXT TRANSPARENT
DisplayKeyboard()
SET TEXT OPAQUE
LastScanCode = SCANCODE()
IF LastScanCode < 10 AND LastScanCode >=0
tempstring$ = "Last Scan Code = 00"+STR$(LastScanCode)
ENDIF
IF LastScanCode < 100 AND LastScanCode >=10
tempstring$ = "Last Scan Code = 0"+STR$(LastScanCode)
ENDIF
IF LastScanCode < 1000 AND LastScanCode >=100
tempstring$ = "Last Scan Code = "+STR$(LastScanCode)
ENDIF
TEXT 1,440, tempstring$
SYNC
ENDWHILE
DELETE BITMAP 1
END
`Displays the keys and
`highlights the ones that are hit
FUNCTION DisplayKeyboard()
WHITE = RGB(255,255,255)
BLACK = RGB(0,0,0)
RED = RGB(255,255,255)
INK WHITE, BLACK
FOR x = 1 TO 256
IF KEYX(x) <> 0
StateOfKey = KEYSTATE(x)
IF StateOfKey = 0
TEXT KEYX(x), KEYY(x), KEY$(x)
ELSE
INK RED, BLACK
TEXT KEYX(x), KEYY(x), KEY$(x)
INK WHITE, BLACK
ENDIF
ENDIF
NEXT x
ENDFUNCTION
`LOADS ALL THE DIM VALUES WITH
`THE DATA VALUES
FUNCTION ReadKeyBoardData()
FOR X = 1 to 256
KEYX(x) = 0
NEXT X
FOR X = 1 TO 256
READ KeyValue
READ KeyName$
READ KeyXpos
READ KeyYpos
[b][u](This is line 177)[/u][/b]READ KEY$(KeyValue) = KeyName$
READ KEYX(KeyValue) = KeyXpos
READ KEYY(KeyValue) = KeyYpos
NEXT X
ENDFUNCTION
When we all lend our power together, there is nothing we
can't do!
Please Lend me your STRENGTH!