LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

GetValuefromIndex

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 );
          
  
  }

0 Kudos
Message 1 of 3
(3,307 Views)

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! Smiley Wink



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 3
(3,303 Views)

Thanks Roberto, that was the problem.

0 Kudos
Message 3 of 3
(3,301 Views)