我在程序中声明了一个TStrings变量T。
请问在程序中如何给他动态赋值。
比如说将N个string存到T中。
然后又如何把T中的字符串按照顺序读入到一个string变量中
请大虾给于代码指点,谢谢。
顺便请问,如何把ListBox当前选中的Item的值赋给listBox的Text属性。
请问在程序中如何给他动态赋值。
比如说将N个string存到T中。
然后又如何把T中的字符串按照顺序读入到一个string变量中
请大虾给于代码指点,谢谢。
顺便请问,如何把ListBox当前选中的Item的值赋给listBox的Text属性。
解决方案 »
- string 转换成tform
- 请教一个关于MDI窗体的问题~~~~~~~~~~~~~~~~~~~~~~~~~~~
- 大四学生朋友过来阿!
- 求一加密算法对1到100的数字加密,加密后的结果仍为数字(因为要放入数据库)普通的字符串加密好像不行 多谢了
- 100分求解!
- 做Delphi越来越难找工作了。
- 12.28之前不来了,散分!
- 求助,循环读取两memo的内容!!!
- 请问DELPHI编写的程序可以不使用动态链接库等。而在别的机器上别的WIN操作系统运行吗?
- socket与多线程相结合的问题?
- 想写一个可以随意设计表单的程序,大家给点思路吧
- 我想在TDBLookupComboBox中显示的内容都能显示出来,不截去他的部分,该如何做?
var T:Tstrings ;
begin
T:=TStringList.create();
t.Append('777');
t.Append('888');
t.Append('999');
listbox1.Items.Assign(t);
t.Free;
end;
T:TStringGrid;
str1,str2:string;
str1:='这是一个字符串';
T:=TStringGrid.Create(Self);
T.Cells[1,1]:=str1;
str2:=T.Cells[1,1];
T.Free;
ShowMessage('T的第一个单元格是:'+str2);ListBox1.Items[ListBox1.ItemIndex]:取出当前所选项的文本
StrList: TStrings;
I: Integer;
begin
StrList := TStringList.Create;
try
StrList.Add('a');
StrList.Add('b');
for I := 0 to StrList.Count - 1 do
begin
ShowMessage(StrList[I]);
end;
finally
StrList.Free;
end;
选中了的话它的Text就是当前选择中Item的Text
ListBox1.Text := ListBox1.Items[ListBox1.ItemIndex];
T.Add('hello');....
用数组或是TStringList
StrList: TStrings;
str: string;
begin
StrList := TStringList.Create;
try
StrList.Add('a');
StrList.Add('b');
str:= StrList.Text;
ShowMessage(str);
finally
StrList.Free;
end;