请教高手:如何用IF..THEN语句判断列表框里是否有内容呢?
我的意思是说:我想用IF..THEN语句来判断列表框.如果列表框里有内容,则就把列表框的ENABLE属性设为真,否则设为假.
我不知道应该用列表框的什么属性才对.我试了半天也不对.不知道这个程序怎么写对?
请高手们帮帮忙吧.谢谢了!
请高手给我写个程序代码.

解决方案 »

  1.   

    列表框?是不是指Listbox?如果是,你可以用这个代码来检查是否有内容:If list1.count > 0 then
       '存在内容
    else
       '内容空白
    end if
      

  2.   

    是listcount这个属性,不过没有必要做enable操作
      

  3.   

    列表框?是不是指Listbox? 如果是,你可以用这个代码来检查是否有内容: If list1.count > 0 then 
       '存在内容 
    else 
       '内容空白 
    end if
      

  4.   

        If List1.ListCount > 0 Then
            List1.Enabled = True
        Else
            List1.Enabled = False
        End If
      

  5.   

    不知是否在线?xinhezai老师,你给我的 If List1.ListCount > 0 Then 
            List1.Enabled = True 
        Else 
            List1.Enabled = False 
        End If
    这个代码不起作用阿?我用了后,还是listbox控件的enabled属性没有变化阿?怎么回事?
      

  6.   

    Private Sub List1_GotFocus()    If List1.ListCount > 0 Then 
            List1.Enabled = True 
        Else 
            List1.Enabled = False 
        End IfEnd Sub
      

  7.   

    明白你的意思了。。dim flag as boolean
    flag=ture
    for i=1 to list1.listcount
      if isempty(list1.listindex(i))="" then
        flag=false
        exit for
      end if
    nextif flag then 
      list1.enabled=true
    else
      list1.enabled=false
    end if