In the attachment there's another project which you directly can run to show you that your error cannot be reproduced. The error can be at so many places, not just in the two code fragments that you post. Please remember: always try to write a complete compilable demo which shows the issue. Pack the pas, lfm, lpi and lpr files into a common zip and upload it here. Also, specifiy your operating system and Lazarus/fpc version, TListbox highly depends on widgetset, therefore the error will not show up in the environment of the reader of your post.