LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

List Box error:out of range

Hi everyone:
   Thank you for your attention.
I am using List Box Control to display test information, but occur error, the hint is out of index range.
I list part relative code for you, maybe you can find some clues and help me .
//====================================================
#define TEST_STATUS_MAX_SIZE ((long) 102400)  
 
long GUI_TestStatus_Write (char *svalue_in)
{
 long lreturn = GUI_ERR_NONE;
 int ilist_item_count = 0;
 
 if (iMainPanelHandle > 0)
 {
      lreturn = (long) GetNumListItems (iMainPanelHandle, MAINPANEL_LISTBOX_TESTSTATUS, &ilist_item_count);
      if ( ilist_item_count > TEST_STATUS_MAX_SIZE )
      { //max data allowed exceeded. clear window.
               lreturn = (long) ClearListCtrl (iMainPanelHandle, MAINPANEL_LISTBOX_TESTSTATUS);  
      }
  
       lreturn = (long) InsertListItem (iMainPanelHandle, MAINPANEL_LISTBOX_TESTSTATUS, -1, svalue_in, 0);
     if (AUTOSCROLL_ENABLE == iAutoScroll)
     {  
               if (ilist_item_count >= 1)
               {
                 lreturn = (long) SetCtrlIndex (iMainPanelHandle, MAINPANEL_LISTBOX_TESTSTATUS, (ilist_item_count-1));
               }
       }
 }
 return lreturn;
}
 
//====================================================
the system break down in SetCtrlIndex (), i do not know how to resolve it
Thank you in advance!
0 Kudos
Message 1 of 3
(3,221 Views)
Duplicated post: see here


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?
0 Kudos
Message 2 of 3
(3,215 Views)
Thank you,'
 I think when the list box is full (102400 item) the error occurs ,which occurs one time about 16 hours ,  i have tried to reset ilist_item_count to zero. and see tommorw's result.
Thank you very much
0 Kudos
Message 3 of 3
(3,210 Views)