this.label6.Text = this.listBox1.Items.Count.ToString()+"条"; 
this.label10.Text = this.listBox2.Items.Count.ToString() + "条";怎么得到 this.listBox1.Items.Count(10) 减this.listBox2.Items.Count(2)的数量=8?

解决方案 »

  1.   

    int count = this.listBox1.Items.Count - this.listBox2.Items.Count;
      

  2.   

    this.label13.Text = Convert.ToInt32(count); 这个怎么强制转换呢?
      

  3.   

    Convert.ToInt32 不是可以强制转换吗? 怎么报错呢?   int()也不行喃
      

  4.   

    其中this.label13.Text 为string类型
    应该是this.label13.Text =count.ToString();
      

  5.   

    +1 
    还有你的问题表述的不清楚。 你要获得两个listbox的行数相减的值吗?
      

  6.   


    因为label.Text是string类型,Convert.ToInt32只是转换成了int型,int类型无法隐式转成string,你的count已经是Int类型了,只需要转成string就可以this.label13.Text=count.ToString();