Jump to content

help with GUICtrlSetData


Recommended Posts

i have a loop that is supposed to add data from an array to a listview window. here is the code:

$i=-1
    for $i=1 to $lines Step 1
    GUICtrlSetData(-1, $array[$i])
    wend
    NEXT

i used a msgbox to make sure the $i value was correct. when i chancge $array[$i] to an actual number it works fine. otherwise i get this error output:

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "F:\test.au3" /autoit3dir "C:\Program Files (x86)\AutoIt3" /UserParams    
+>14:01:05 Starting AutoIt3Wrapper v.2.0.0.1    Environment(Language:0409  Keyboard:00000409  OS:WIN_VISTA/  CPU:X64 OS:X64)
>Running AU3Check (1.54.14.0)  from:C:\Program Files (x86)\AutoIt3
+>14:01:05 AU3Check ended.rc:0
>Running:(3.3.0.0):C:\Program Files (x86)\AutoIt3\autoit3.exe "F:\test.au3" 
F:\test.au3 (25) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:
GUICtrlSetData(-1, $array[$i])
GUICtrlSetData(-1, ^ ERROR
->14:01:05 AutoIT3.exe ended.rc:1
+>14:01:06 AutoIt3Wrapper Finished
>Exit code: 1   Time: 1.362

any ideas?

Link to comment
Share on other sites

your array is probably zero based:

for $i=0 to $lines - 1
    GUICtrlSetData(-1, $array[$i])
    NEXT
oh duh! i knew it was zero based and just totally forgot that -1 part. i have it in a previous part of the code just just spaced on it. i feel stupid now. :D thanks for the help!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...