delphi如何实现鼠标选中listbox一字符串赋值给一变量

来源:百度知道 编辑:UC知道 时间:2024/06/07 13:08:58
我想把listbox中获取的字符串列表的某一列赋值给一变量,然后对这一列字符串进行操作,应该怎样可以实现,请各位大哥帮帮小弟!!!
字符串是用鼠标选择,选择后赋值给另一变量,这步不知道怎么写

ListBox1.Items[1] := 'AA';
ListBox1.Items[ListBox1.ItemIndex] := 'AA';

var
s: string;
begin
s := listbox1.items[listbox1.itemindex];
end;

为什么反过来就不会了呢?

var
str: string;
begin
str := listbox1.items[listbox1.itemindex];
//然后对STR进行操作处理
end;