现有ListBox1和ListBox2,ListBox1和ListBox2中已经有若干个值了(它们的值是一样的),我现在随机通过勾选来选中其中的5个值,把这5个值放进一个字符串变量str中,并用逗号隔开,就像这样:1,3,6,10,13 现在问题是这样的。怎样把我选定的值在ListBox2中相对应的Checked赋值成True?procedure TForm1.Button1Click(Sender: TObject);
var
i: integer;
str :string;
begin
//我用的是第三方控件中的ListBox
for i:=0 to TeThemeListBox1.Items.Count-1 do
begin
if TeThemeListBox1.State[i] = cbChecked then
str := str+TeThemeListBox1.Items.Strings[i]+',';
end;
//在这里写代码,怎样把str拆成相应的值,并使TeThemeListBox2中对应值的Checked赋成True
end;
var
i: integer;
str :string;
begin
//我用的是第三方控件中的ListBox
for i:=0 to TeThemeListBox1.Items.Count-1 do
begin
if TeThemeListBox1.State[i] = cbChecked then
str := str+TeThemeListBox1.Items.Strings[i]+',';
end;
//在这里写代码,怎样把str拆成相应的值,并使TeThemeListBox2中对应值的Checked赋成True
end;
解决方案 »
- 离职了,再来一次
- 新年首贴:100分讨论,在数据库设计中,字段冗余带来的好处和风险
- 关于Delphi中的嵌入式语句的一个小问题??
- 下了一个delphi做的系统,却总是不能正确的运行出来,想知道为什么
- 请问WordApplication.Documents.Open(参数)里的参数怎么写?在线等待
- 双击一控件,怎样能获取该控件的名称!如双击DBEdit1,怎样把它的名字赋值给一变量!
- 怎样将stringgrid里的数据导入数据库(高分)!!!!
- C/S高手帮忙,急!!!
- 如何定义一个整型的数组,取得字符串长度、取得字符串左边几个字符串、取得字符串右边几个字符串的函数分别是什么呀?
- 通过外部程序控制,点击按钮btn1就相当于点击按钮btn2。
- 哪里有大量的案例可供学习?
- 我用fastreport做报表,如何对数据表中的一列求总和显示?
var
i: integer;
str :string;
k: Integer;
begin
//我用的是第三方控件中的ListBox
for i:=0 to TeThemeListBox1.Items.Count-1 do
begin
if TeThemeListBox1.State[i] = cbChecked then
Begin
for k:=0 to TeThemeListBox2.Items.Count-1 do
if TeThemeListBox2.Items.Strings[k] = TeThemeListBox1.Items.Strings[i] Then
TeThemeListBox2.State[k] := cbChecked;
End;
end;
end;