Reputation: 4435
this seems like a really simple one, but i'm new to delphi and google has not turned up anything...
i have an Edit field on my form and i have created a component which has a function of the form:
type
TComms = class(TComponent)
published
function BuildPacket(const APacketData: string): string;
now i pass the output of the edit form to the function like so:
procedure TForm1.xxxxx(Sender: TObject)
var
NewPacket: string;
begin
NewPacket := Comms.BuildPacket(EditVal);
end;
and i get the error
Incompatible types 'String' and 'TEdit'
should i convert the Edit value to a string? or should my component do the conversion? i don't want to make the input a property of the component or anything - just an argument to the BuildPacket
function.
Upvotes: 2
Views: 7365
Reputation: 3127
Yeah, you're passing the edit box itself, and not the value of it. Try:
NewPacket := Comms.BuildPacket(EditVal.text);
Upvotes: 10