LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

listbox line limit

there is a max number of lines that i can insert to a list box?
i tried to inset more then 3000 lines to the listbox
but it does FATAL run time error
when on the line RunUserInterface()
please check this attach project press on the open button

10x

hanan
0 Kudos
Message 1 of 7
(3,334 Views)
This looks like a problem in CVI. There shouldn't be a limit to the list box entries outside of system memory. I will have our developers look at the problem. As a workaround, have you tried using a table control?

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 7
(3,334 Views)
Hi Hanan,

I tested your program and it's definitely crashing, although I'm not sure that it's related to the ListBox per se, since I've been able to add well over 4000 lines to the ListBox before (see attached code). I'll check with the developers and keep you posted on my findings.

Regards,
Azucena Perez
NI
Message 3 of 7
(3,334 Views)
thanks you both
i changed my code to something else and its work now
without any problem, i added more then 100,000 lines.
maybe it isnt related to the listbox and its something
about my function that insert the data into the list
hanan
0 Kudos
Message 4 of 7
(3,334 Views)
Hanan,

I've been able to isolate the problem to the function AteMessageHandler. This really has nothing to do with the ListBox, as I have commented out the following three lines

InsertListItem (MainPanelHandle,ANEL_LOGGER_LISTBOX, -1, Line, -1);
/* Set last line as visible */
GetNumListItems (MainPanelHandle, PANEL_LOGGER_LISTBOX,&NumOfLines);
SetCtrlIndex (MainPanelHandle, PANEL_LOGGER_LISTBOX, NumOfLines-1);

and still get the crash. Hopefully we can figure out what's crashing....

Azucena
Message 5 of 7
(3,334 Views)
I think I know why the code is crashing. It has to do with the following lines of code (commenting these lines out doesn cause a crash):

va_start(ap,format);
vsprintf(Message,(const char *)format,ap);
va_end(ap);

and in particular with the function vsprintf. We noticed that the "ap" parameter is not being initialized and there is only one parameter to AteMessageHandler(szLine). So ap is popped off the stack and then vsprintf tries to format it according to the "%specifier" contained in format. If you use sprintf instead of vsprintf, you should get better error information. I would discourage the use of the uninitialized parameter "ap", as it doesn't seem to be doing any formating at all.

Hope this helps,
Azucena
NI
Message 6 of 7
(3,334 Views)
listbox line limit - problem source"

The problem is that the format messages from the b.txt file contain the printf conversion code '%'.

Especially the "%+-2nF" part is dangerous because it is a valid format code that writes to an unspecified memory location.

Either you can replace all '%' with '%%' before using the printf function, or you can try the NI Fmt function.

Hope this helps.

Greetings
MAK
Message 7 of 7
(3,334 Views)