ive hit a major lazarus / 10-Designer ---------------------------------------------------------------------- cazzajay · 2009-08-06 15:08 stumbling block!  in my program, the user clicks on a tlistbox that may (or may not) be populated with items.  the program then runs various tasks based on the selected item in the listbox. if the listbox is blank, or if the user clicks outside the items (i.e. in white space), i get an out of bounds error with the kill/corrupt options. the error seems to be inevitable, is there any way of changing the text in the errormessage to say something more friendly like "please only click on items" or even to just silently "ignore" the fact it is out of bounds altogether and do nothing at all if the user clicks on a non-item??? i've tried changing it to dblclick but that doesn't force the user to highlight and click on an item. im at a complete loss as to this one. ---------------------------------------------------------------------- Martin_fr · 2009-08-06 15:18 There is a lot of info missing, in order to see what your issue is. Assuming you have not recompiled lazarus/the LCL with rangececks enabled, then the exception is in your code. You probably have an OnClick or similar handler. One way is to encapsulate the whole code inside in a try except end block  procedure TForm1.ListBox1Click(Sender: TObject);  begin    try     // your code    except     // handle errors    end;  end; Then again are you using ItemIndex? simply check if it is not negative   if Listbox.itemindex<0 then exit; // or display error or.... If the error is not in your code, provide which version of Lazarus you use and a sample how to trigger it. ---------------------------------------------------------------------- cazzajay · 2009-08-06 15:37 the "itemindex < 0" worked!  i can't believe i didnt think of that one! fyi i was using listbox1.items[listbox1.itemindex] to get the currently selected item.  i'm not too comfortable with exceptions just yet, so this way seemed best.  im using 0.9.26.2 on vista 32 bit (running in bootcamp on a macbook  )