本人想做一个类似QQ登陆时,记录登陆过的用户号!!
写了句,没用
ComboBox1.Items.Add(ComboBox1.Text);
但Delphi里的ComboBox好象是只读的属性!!只能改索引
QQ好象是读的文件夹的名字!!Delphi中不知道能不能实现
写了句,没用
ComboBox1.Items.Add(ComboBox1.Text);
但Delphi里的ComboBox好象是只读的属性!!只能改索引
QQ好象是读的文件夹的名字!!Delphi中不知道能不能实现
调试欢乐多
if key=char(13) then
if (combobox1.text<>'') and (combobox1.items.indexof(combobox1.text)<0) then
combobox1.items.add(combobox1.text);
var
k,posk:integer;
urls:string;
begin
urls:=ComboBox1.Text;
for k:=0 to combobox1.items.count-1 do Begin
posk:=pos(urls,combobox1.Items[k]);
If posk>0 Then Exit;
End;
ComboBox1.Items.Add(urls);
combobox1.Items.SaveToFile('c:\url.txt');
end;
if (combobox1.text<>'') then
combobox1.items.add(combobox1.text);当然,应该再增加一点,如检查当前输入的内容是否已经被增加进去了。这个就留给自己考虑吧。
Pos是干什么用的??呵呵!!英文不太好!!没看明白!!帮人帮到底!!麻烦讲讲!In Delphi, Pos searches for a substring, Substr, in a string, S. Substr and S are string-type expressions.Pos searches for Substr within S and returns an integer value that is the index of the first character of Substr within S. Pos is case-sensitive. If Substr is not found, Pos returns zero.The PosEx function is similar to Pos, but provides additional features and can be used in C++ code.
pos(urls,combobox1.items[k])
是在字符串urls中找combobox1.items[k]的值出现的位置,返回的是combobox1.items[k]的第一个字母在urls中出现的位置,返回的是整型!如果没找到,返回0
ComboBox1.Items.Add(urls);(你)
好象没什么区别!!
为什么你的可以读进去呢???
‘posk’这个变量好象没什么用啊!!