Recent

Author Topic: (Solved)Another error. Dont see it.  (Read 264 times)

JLWest

  • Hero Member
  • *****
  • Posts: 934
(Solved)Another error. Dont see it.
« on: October 03, 2020, 09:24:55 am »
The error is on line 8 and says unit1.pas(434,12) Error: Operator is not overloaded: - "AnsiString"

It's declared as a string; Listbox's are only string.
So Hiw dioes it come uo with that error.

I posted the code at this URL if needed.

https://drive.google.com/file/d/154EZ7YwT1XfhdIUEVE3pb1AZ_Lz7yT4e/view?usp=sharing

TopBox is a listbox.

Code: Pascal  [Select][+][-]
  1. procedure TForm1.Transfer1302;
  2.  Var i : Integer = -1;
  3.   Bit1,Bit2,Bit3 : String;
  4.  begin
  5.   Lowerbox.Clear;
  6.   Application.ProcessMessages;
  7.   for i := 0 to TopBox.Items.Count -1 do begin
  8. -     bit3 := TopBox.Items[i];                           {Operator is not overloaded error}
  9.       Bit1 := TopBox.Items[i];
  10.       Bit2 := Copy2SpaceDel(Bit1);
  11.       Bit1 := Trim(Bit1);
  12.       Bit1 := Copy2Space(Bit1);
  13.       if Bit1 = '1302' then begin LowerBox.Items.Add(Bit3); endl
  14.   end;
  15.    i := Lowerbox.Items.Count;
  16.    Lbl1302.Caption := IntToStr(i);
  17.  end;
  18. \  
« Last Edit: October 03, 2020, 09:29:51 am by JLWest »
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

howardpc

  • Hero Member
  • *****
  • Posts: 3583
Re: (Solved)Another error. Dont see it.
« Reply #1 on: October 03, 2020, 10:12:08 am »
You have a stray "-" at the start of line 8 which the compiler notices, but you overlooked.

JLWest

  • Hero Member
  • *****
  • Posts: 934
Re: (Solved)Another error. Dont see it.
« Reply #2 on: October 04, 2020, 08:36:50 am »
@hhoward

Thanks I finally saw it but after I posted.
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

 

TinyPortal © 2005-2018