如何在列表框项目达到0时显示消息框 [英] How Do I show message box when Listbox items reaches 0
本文介绍了如何在列表框项目达到0时显示消息框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码
< pre lang = xml > private void timer5_Tick(object sender,EventArgs e)
{
timer5.Enabled = false;
if(listBox1.Items.Count & gt; 0)
{
listBox1.Items.RemoveAt( 0);
progressBar1.Increment(1);
groupBox1.Text = listBox1.Items.Count.ToString();
timer5.Enabled = true;
}
if(listBox1.Items.Count == 0)
{
juggler.Send(& quot;& lt; message to ='& quot; + textBox3.Text +& quot; @ conference.jabber.com'type ='groupchat'& gt;& lt; body& gt; MEMBERS LIST IS CLEAR SIR:D:p& lt; / body& gt;& ; LT; /消息和; GT;&安培; QUOT);
}
} < / pre >
listBox1.items .count == 0当计时器每3秒钟从listbox1中删除项目时达到0时不工作
解决方案
在第二个条件下尝试
if(listBox1.Items.Count< = 0)
{
//你的代码
}
here is my code
<pre lang="xml">private void timer5_Tick(object sender, EventArgs e)
{
timer5.Enabled = false;
if (listBox1.Items.Count > 0)
{
listBox1.Items.RemoveAt(0);
progressBar1.Increment(1);
groupBox1.Text = listBox1.Items.Count.ToString();
timer5.Enabled = true;
}
if (listBox1.Items.Count == 0)
{
juggler.Send("<message to='" + textBox3.Text + "@conference.jabber.com' type='groupchat'><body>MEMBERS LIST IS CLEAR SIR :D:p</body></message>");
}
}</pre>
listBox1.items.count == 0 not working when reaches 0 when timer is deleting items from listbox1 after every 3 seconds
解决方案
in second condition try
if(listBox1.Items.Count <=0)
{
// your code
}
这篇关于如何在列表框项目达到0时显示消息框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文