05-26-2011 03:21 PM
Hi, I need some help here.
I created a list box, inserting items with
InsertListItem (panelHandle, PANEL_CPE_SELEC_2, numbLines, selections,...);
Now I am trying the read the value from of each Item, I am getting an error saying
NON-FATAL RUN-TIME ERROR: "SmartBits.c", line 1912, col 17, thread id 0x00000964: Library function error (return value == -55 [0xffffffc9]). The index passed is out of range
I need some help here
GetNumListItems (panelHandle, PANEL_CPE_SELEC_2, &numbItems);
printf ("\nNumber of Items: %d",numbItems);
for (numIt=0; numIt< (numbItems); numIt++);
{
GetValueFromIndex (panelHandle, PANEL_CPE_SELEC_2, numIt, &itemValue);
printf ("Value : %d\n",itemValue );
}
05-26-2011 03:42 PM
I suppose the problem is in the semicolon at the end of for statement:
for (numIt=0; numIt< (numbItems); numIt++);
{
GetValueFromIndex (panelHandle, PANEL_CPE_SELEC_2, numIt, &itemValue);
printf ("Value : %d\n",itemValue );
}
The program executes the for loop doing nothing and exits it with numIt > numbItems; next it runs GetValueFromIndex with an incorrect index et voilà, the error!
05-26-2011 04:02 PM
Thanks Roberto, that was the problem.