本人想做一个类似QQ登陆时,记录登陆过的用户号!!
写了句,没用
ComboBox1.Items.Add(ComboBox1.Text);
但Delphi里的ComboBox好象是只读的属性!!只能改索引
QQ好象是读的文件夹的名字!!Delphi中不知道能不能实现

解决方案 »

  1.   

    在combobox的keypress事件中输入:
       if key=char(13)  then
          if (combobox1.text<>'') and (combobox1.items.indexof(combobox1.text)<0) then
          combobox1.items.add(combobox1.text);
      

  2.   

    KeyDown 中判断输入重复combobox里的AutoComplete 属性设为true就可以实现自动定位
      

  3.   

    combobox1.items.add(combobox1.text);'combobox1.text'写什么都没用!!根本不读括号中的东西
      

  4.   

    procedure TForm1.Button1Click(Sender: TObject);
    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;
      

  5.   

    请首先确定Combobox的Enabled属性是否为只读,然后在Onexit中写程序就可
    if (combobox1.text<>'')  then
          combobox1.items.add(combobox1.text);当然,应该再增加一点,如检查当前输入的内容是否已经被增加进去了。这个就留给自己考虑吧。
      

  6.   

    To qq153788616(123456)posk:=pos(urls,combobox1.Items[k]);
    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.
      

  7.   

    pos 寻找字符串出现的位置
    pos(urls,combobox1.items[k])
    是在字符串urls中找combobox1.items[k]的值出现的位置,返回的是combobox1.items[k]的第一个字母在urls中出现的位置,返回的是整型!如果没找到,返回0
      

  8.   

    ComboBox1.Items.Add(ComboBox1.Text);(我)
    ComboBox1.Items.Add(urls);(你)
    好象没什么区别!!
    为什么你的可以读进去呢???
      

  9.   

    如果象dashi111(sally) 说的
    ‘posk’这个变量好象没什么用啊!!
      

  10.   

    pos 是定位一个串在另一个串中的位置
      

  11.   

    combobox1.items.add(combobox1.text)是可以的,检查你是不是别处错了