ListBox中插入数据Str,第二个函数,我想重载。就是使用两个,三个参数都可以。当第三个参数为false的时候,能插入相同的值,如果为True则不可以。
function AddStrTOLst(lst:TListBox;Str:string):Boolean;
var //true 已经存在 false 不存在
len,i:Integer;
begin
len:=lst.Count;
if len<>-1 then
begin
for i:=0 to len-1 do
if Str=lst.Items[i] then
begin
Result:=False;
Exit;
end;
lst.Items.Add(Str);
Result:=True ;
Exit;
end;
lst.Items.Add(Str);
Result:=True ;
end;function AddStrToLst(lst:TListBox;Str:string;P:Boolean):Boolean;overload;
var //true 已经存在 false 不存在
len,i:Integer;
begin
end;
[错误] cbb_lst.pas(98): Previous declaration of 'AddStrTOLst' was not ed with the 'overload' directive
function AddStrTOLst(lst:TListBox;Str:string):Boolean;
var //true 已经存在 false 不存在
len,i:Integer;
begin
len:=lst.Count;
if len<>-1 then
begin
for i:=0 to len-1 do
if Str=lst.Items[i] then
begin
Result:=False;
Exit;
end;
lst.Items.Add(Str);
Result:=True ;
Exit;
end;
lst.Items.Add(Str);
Result:=True ;
end;function AddStrToLst(lst:TListBox;Str:string;P:Boolean):Boolean;overload;
var //true 已经存在 false 不存在
len,i:Integer;
begin
end;
[错误] cbb_lst.pas(98): Previous declaration of 'AddStrTOLst' was not ed with the 'overload' directive
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货