delphi中的add到底是函数还是方法?
来源:百度知道 编辑:UC知道 时间:2024/07/05 07:16:38
是TStrings 下的一个函数,
这是在TStrings下定义的这个函数
function Add(const S: string): Integer; virtual;
Description
Call Add to add a string to the end of the list. Add returns the index of the new string.
返回值是添加后的序号: returns the index of the new string.
Items属性, memo的Lines 属性,都属于TStrings 对象.
你自己创建个一个TStrings;
var ss:TStrings;
ss:=TStringList.create();
ss.add('abc');
帮助中你看看ListBoxs的Items属性,就是一个TStrings
------------摘自delphi 帮助------------
Contains the strings that appear in the list box.
property Items: TStrings;
Description
Use Items to add, insert, delete and move items. By default, the items in a list box are of type TStrings. Use this item type to access its methods or properties to manipulate the items in the list.
For example, the following code adds the text in the edit box to the list box as an item:
ListBox1.Items.Add(Edit1.