我想问一下,listView怎么判断是否有记录啊???

解决方案 »

  1.   

    if ListView.Items.Count>0 then
      

  2.   

    我是说 
    标题    卡号       信号
          222222     为空
    为空是 listview.Items[i].SubItems.add('3'); //还没添加怎么判断信号下面的值是没有或者为空啊 
      

  3.   


    if listview.Items[i].Subitems.Strings[1]='' then
    begin
      ...
    end;
      

  4.   

    if listview.Items[i].SubItems.Count<=2 then
      listview.Items[i].SubItems.add('3')
    else if listview.Items[i].SubItems[3]='' then
      listview.Items[i].SubItems[3]='3'
      

  5.   

    判断 listview.Items[i].SubItems.Count
      

  6.   

    是为空的时候会报错吗
    添加的时候可以先给subItems添加一个空值
    listview.Items[i].SubItems.add('') 
      

  7.   

    建立函数
    function YesEmpt(S):Boolean;
    begin
      YesEmpt:=False;
      //  检查s中信号为空,代码自己搞定吧   
      if ... then 
        YesEmpt:=True;
    end; 主程序中:
    var T:boolean;T:=false; 
    for i:=0 to ListView.Items.Count-1 do
    begin
      S:=ListView.Items[i];
      if YesEmpt(S) then T:=True; 
    end;
      if T then ...            //  信号空的代码 
           else ...       ;    //  信号非空的代码 
      

  8.   

    Listview.items.count > 0 if ListViewIP.Selected = nil then exit;