确定没有列表框 [英] sure that empty of listbox

查看:66
本文介绍了确定没有列表框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi
我有一个列表框。我想知道我怎么能确定这个列表框是空的?

hi i have a listbox. i want to know how can i sure that this listbox is empty?

推荐答案

试试:

Try:
if (myListBox.Items.Count == 0)
    {
    ...
    }


使用列表框的Items属性及其属性Count:



Use the Items property of the listbox and its property Count:

if (listBox1.Items.Count > 0)
{
    // There are items in the listbox
}
else
{
    // The listbox is empty
}





问候,



Manfred



Regards,

Manfred


这篇关于确定没有列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆