[SOLVED] TDbf Locate - HOW lazarus / 16-Databases ---------------------------------------------------------------------- arwen · 2007-12-01 10:57 I have a little poroblem with locate , the code below work only if i load a string in "appoggio" but if i try to load a selected text from a list box (the text exist in the database) it don't work. Code: [Select]       FRM_Masters.Dbf1.Edit; // Edit mode        appoggio := ListBox1.GetSelectedText ;       //<--- this don't work        //appoggio := 'Bilance';                                     //<--- this work        // Change value only if a selection is made        if ListBox1.ItemIndex >= 0 then        begin             if DBf1.Locate('DESC_CODA',appoggio,[]) then             begin             FRM_Masters.Caption := 'Trovato';             FRM_Masters.DBf1.FieldValues['CODA']:=DBf1.FieldValues['CODE'] ;             end;                   When I debug the difference in "appoggio" is that when I load a string the watch is like Code: [Select]appoggio   "Termometro" When in appogio I load the text of the list box in watch I have Code: [Select]appoggio "Termometro" #10 Wath is   #10 The field DESC_CODA is a " ftString,40" How to solve (I'm going mad)  :evil: Thanks to all and have a good WeekEnd . ---------------------------------------------------------------------- Leledumbo · 2007-12-03 06:39 By default, it will append a LineEnding character to the text you take from a LsitBox. Use Trim to remove it. ---------------------------------------------------------------------- arwen · 2007-12-03 08:42 Solved !! Thanks Leledumbo !! Now with this works Code: [Select] appoggio := TrimRight(ListBox1.GetSelectedText);  // trim control char