通过edit1.text:=ValueListEditor1.Values[ValueListEditor1.Keys[n]] 可以把第n行的value的信息显示在edit1上面我现在要想通过values的值来获得行号n 不知各位有何高见PS:edit1.text:=ValueListEditor1.Keys[ValueListEditor1.Values['字符串']] 没有用
错误信息:Incompatible types: 'Integer' and 'String'edit1.text:=inttostr(ValueListEditor1.Keys[ValueListEditor1.Values['字符串']])以及加trim都没有用 报的一样的错误请各位提供点有效的意见,不胜感激!
错误信息:Incompatible types: 'Integer' and 'String'edit1.text:=inttostr(ValueListEditor1.Keys[ValueListEditor1.Values['字符串']])以及加trim都没有用 报的一样的错误请各位提供点有效的意见,不胜感激!
没错啊~~
你的n是什么类型,是不是integer?
[Code=Delphi]
function FindKeyIndex(strings: TStrings; const value: string): Integer;
var
i: Integer;
begin
Result := -1;
for i := 0 to strings.Count - 1 do
begin
if AnsiSameText(strings.ValueFromIndex[i], value) then
begin
Result := i;
Break;
end;
end;
end;
[Code]
function FindKeyIndex(strings: TStrings; const value: string): Integer;
var
i: Integer;
begin
Result := -1;
for i := 0 to strings.Count - 1 do
begin
if AnsiSameText(strings.ValueFromIndex[i], value) then
begin
Result := i;
Break;
end;
end;
end;
function FindKeyIndex(strings: TStrings; const value: string): Integer;
var
i: Integer;
begin
Result := -1;
for i := 0 to strings.Count - 1 do
begin
if AnsiSameText(strings.ValueFromIndex[i], value) then
begin
Result := i;
Break;
end;
end;
end;
function FindKeyIndex(strings: TStrings; const value: string): Integer;
var
i: Integer;
begin
Result := -1;
for i := 0 to strings.Count - 1 do
begin
if AnsiSameText(strings.ValueFromIndex[i], value) then
begin
Result := i;
Break;
end;
end;
end;