且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何计算列表框中的项目数?

更新时间:2023-11-28 20:01:04

类似的东西以下代码应该这样做。


for(int x = 0; x< this.listBox1.Items.Count; x ++)

{

this.listBox1.SetSelected(x,true);

}


-

Tim Wilson

..Net Compact Framework MVP

" Alpha" &LT;铝*** @ discussions.microsoft.com&GT;在消息中写道

news:82 ********************************** @ microsof t.com ...
Something similar to the following code should do it.

for (int x = 0; x < this.listBox1.Items.Count; x++)
{
this.listBox1.SetSelected(x, true);
}

--
Tim Wilson
..Net Compact Framework MVP

"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:82**********************************@microsof t.com...
您好,如何设置列表框中的所有项目?我找不到
a属性或mehtod这样做所以我想我会尝试使用setselected方法
但我需要找出列表框中有多少项。
Alpha
Hi, How can I set all the items in a listbox to be selected? I can''t find a property or mehtod to do it so I thought I''ll try using setselected method
but I need to find out how many items are in the listbox.

Thanks,
Alpha



非常酷!非常感谢你。

周末愉快!

Alpha


蒂姆威尔逊写道:
Very cool! Thank you so much again.
Have a great weekend!
Alpha

"Tim Wilson" wrote:
类似于以下代码的东西应该这样做。

for(int x = 0; x< this.listBox1.Items.Count; x ++)
{
this.listBox1.SetSelected(x,true);
}

-
蒂姆威尔逊
..Net紧凑框架MVP

Alpha &LT;铝*** @ discussions.microsoft.com&GT;在消息中写道
新闻:82 ********************************** @ microsof t.com。 ..
Something similar to the following code should do it.

for (int x = 0; x < this.listBox1.Items.Count; x++)
{
this.listBox1.SetSelected(x, true);
}

--
Tim Wilson
..Net Compact Framework MVP

"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:82**********************************@microsof t.com...
您好,如何设置列表框中的所有项目?我找不到
Hi, How can I set all the items in a listbox to be selected? I can''t find


一个

属性或mehtod这样做所以我想我会尝试使用setselected方法
但我需要找出来列表框中有多少项。

谢谢,
Alpha
property or mehtod to do it so I thought I''ll try using setselected method
but I need to find out how many items are in the listbox.

Thanks,
Alpha




上面的方法适用于列表框中的少量项目,但如果

你有很多项目。 (100,000)它太慢或者不起作用。有没有

任何其他方式来完成相同的事情,但可能会更快。


TIA,


Fritz

" Alpha" &LT;铝*** @ discussions.microsoft.com&GT;在留言中写道

新闻:6F ********************************** @ microsof t.com ...
The method above is good for a small number of items in the listbox, but if
you have many. (100,000) it is either too slow or doesn''t work. Is there
any other way to accomplish the same thing, but may be faster.

TIA,

Fritz
"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:6F**********************************@microsof t.com...
非常酷!再次感谢你。
周末愉快!
阿尔法

蒂姆威尔逊写道:
Very cool! Thank you so much again.
Have a great weekend!
Alpha

"Tim Wilson" wrote:
类似于以下代码的东西应该这样做。

for(int x = 0; x< this.listBox1.Items.Count; x ++)
{
this.listBox1.SetSelected(x,true);
}

-
蒂姆威尔逊
..Net紧凑框架MVP

Alpha &LT;铝*** @ discussions.microsoft.com&GT;在消息中写道
新闻:82 ********************************** @ microsof t.com。 ..
Something similar to the following code should do it.

for (int x = 0; x < this.listBox1.Items.Count; x++)
{
this.listBox1.SetSelected(x, true);
}

--
Tim Wilson
..Net Compact Framework MVP

"Alpha" <Al***@discussions.microsoft.com> wrote in message
news:82**********************************@microsof t.com...
>如何设置列表框中的所有项目?我不能
>找到
> Hi, How can I set all the items in a listbox to be selected? I can''t
> find


>属性或mehtod这样做所以我以为我会尝试使用setselected
>方法
>但是我需要找出列表框中有多少项目。
>
>谢谢,
> Alpha
> property or mehtod to do it so I thought I''ll try using setselected
> method
> but I need to find out how many items are in the listbox.
>
> Thanks,
> Alpha