ListBox2.Items 与 ListView1.Items.Item[i].Caption  不是同一类型吗?
ListView1.Items.Item[i].Caption是字符型而ListBox2.Items不是吗?
如果不是怎样把ListView1.Items.Item[i].Caption的类型转换为ListBox2.Items的类型呢?谢谢前辈  如果是同类型那么我 showmessage(ListView1.Items.Item[0].Caption);  可以
但是showmessage(ListBox1.Items);就不行,不知道怎么回事呢?

解决方案 »

  1.   

    ListBox.Items的类型是TStrings,ListView1.Items.Item[i].Caption的类型是string。
    ShowMessage(ListBox1.Items[0]);这样就行了。
      

  2.   

    如何把string转为TStrings呢?我需要用后者这个控件
      

  3.   

    listBox2.Items.add(Listview1.Items[I].caption);
      

  4.   

    如何把string转为TStrings呢?我需要用后者这个控件没有听说过。。不过你可以将String赋值给Tstrings的Text属性呀。
      

  5.   

    string可以用add()的方法添加進去 TstringList 裡面,
    相反,TstringList的條目可以用 TstringList.string[i]來取出來。
      

  6.   

    ListBox2.items[ListBox2.itemindex].text:=ListView1.items[ListView1.selected].caption;
    前提是你的ListView1里面必需要用项目