문제

I have a Valuelisteditor that looks like this

Key   |  Name  |
---------------|
Car   |  Audi  |
Nick  |  Yummi |
Age   |  70    |

and I want to modify the key "Nick" in Row 2 and keep the Name "Yummi".
I do not want to rewrite the whole row.
I just want to change "Nick" in "Nickname".

How can I do this in one strike?

도움이 되었습니까?

해결책

Find the row you want to change, and then update the appropriate Cell:

var
  iRow: Integer;
begin
  // Find the row containing 'Nick' as the key
  ValueListEditor1.FindRow('Nick', iRow);
  // If it was found, update the key value (column 0 of the row)
  if iRow > -1 then
    ValueListEditor1.Cells[0, iRow] := 'NewNick';
end;

Note that TValueListEditor.Cells are 0 based, where the columns are Keys (column 0) and Values (column 1).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top