如何获得ListView中的某一个值,
如:第二行第三列得值;

解决方案 »

  1.   

    if 第一列
      listviw.items[RowNo - 1].Caption
    else
      listviw.items[RowNo - 1].substrings[ColNo - 2]返回的都是string
      

  2.   

    惭愧substrings => subItems
      

  3.   

    procedure TForm1.ListView1Click(Sender: TObject);
    var
      Row, Col: Integer;
    begin
      Row := 2;
      Col := 3;
      showmessage(ListView1.Items[Row - 1].SubItems[Col - 2]);
    end;
      

  4.   

    procedure TForm1.ListView1Click(Sender: TObject);
    var
      Row, Col: Integer;
    begin
      Row := 2;
      Col := 3;
      ShowMessage(ListView1.Items[Row - 1].Caption);  //第Row行,第1列
      showmessage(ListView1.Items[Row - 1].SubItems[Col - 2]);//第Row行, 第Col列 Col>1
    end;
      

  5.   

    for i := 0 to ListView.Items.Count - 1 do
        begin
          if (ListView.Items.Item[i].Caption = '***') then
             showmessage(ListView.Items.Item[i].SubItems[0] + 
                         ListView.Items.Item[i].SubItems[1] ); 
        end