将项添加到选中的列表框 [英] Adding an item to a Checked List Box

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

问题描述

您好,


我正在尝试将项目添加到选中的列表框中,例如:


clbList.Items.add( 你好,真的)


我收到错误:


抛出运行时异常:System.ArgumentOutOfRangeException - 指定的

参数超出了有效值的范围。参数名称:'' - 1''不是

索引的有效值。


这不是很有意义吗?有什么想法会发生这种情况吗?


问候

Simon Jefferies

工具程序员,Headfirst Productions

mailto:si **** @ headfirst.co.uk

-

Hello,

I am trying to add an item to a checked list box, like:

clbList.Items.add("Hello",true)

I get an error back:

Run-time exception thrown: System.ArgumentOutOfRangeException - Specified
argument was out of the range of valid values. Parameter name: ''-1'' is not a
valid value for index.

This doesn''t make a lot of sense? Any ideas why this happens?

Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:si****@headfirst.co.uk
-

推荐答案

Simon,


*" Simon Jefferies" < SI **** @ headfirst.co.uk> scripsit:
Simon,

* "Simon Jefferies" <si****@headfirst.co.uk> scripsit:
我正在尝试将一个项目添加到一个选中的列表框中,例如:

clbList.Items.add(" Hello",true)

我收到错误:

抛出运行时异常:System.ArgumentOutOfRangeException - 指定的
参数超出了有效值的范围。参数名称:'' - 1''不是索引的有效值。

这不是很有意义吗?任何想法为什么会发生这种情况?
I am trying to add an item to a checked list box, like:

clbList.Items.add("Hello",true)

I get an error back:

Run-time exception thrown: System.ArgumentOutOfRangeException - Specified
argument was out of the range of valid values. Parameter name: ''-1'' is not a
valid value for index.

This doesn''t make a lot of sense? Any ideas why this happens?




我无法重现。你确定这一行会抛出

异常吗?您使用的是哪个版本的.NET?


-

Herfried K. Wagner [MVP]

< URL: http://dotnet.mvps.org/>



I am not able to repro that. Are you sure this line throws the
exception? Which version of .NET do you use?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>


" Simon Jefferies" < SI **** @ headfirst.co.uk> schrieb
"Simon Jefferies" <si****@headfirst.co.uk> schrieb
您好,

我正在尝试将一个项目添加到一个选中的列表框中,例如:

clbList.Items.add(" Hello,,true

我收到错误:

抛出运行时异常:System.ArgumentOutOfRangeException -
指定的参数超出了有效范围值。参数
名称:'' - 1''不是索引的有效值。

这没有多大意义?任何想法为什么会发生这种情况?
Hello,

I am trying to add an item to a checked list box, like:

clbList.Items.add("Hello",true)

I get an error back:

Run-time exception thrown: System.ArgumentOutOfRangeException -
Specified argument was out of the range of valid values. Parameter
name: ''-1'' is not a valid value for index.

This doesn''t make a lot of sense? Any ideas why this happens?




无法用VB 2003重现问题。请告诉我真正的代码行(

以上不是。)

-

Armin


如何报价以及原因:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote .html



Can''t repro the prob with VB 2003. Please show me the real line of code (the
above one isn''t).
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html


是的,线条会变绿并打破它。


我是使用.NET 2003.


问候

Simon Jefferies

工具程序员,Headfirst Productions

mailto :si **** @ headfirst.co.uk

-

" Herfried K. Wagner [MVP]" <喜*************** @ gmx.at>在消息中写道

新闻:uY ************** @ TK2MSFTNGP11.phx.gbl ...
Yes, the line goes green and breaks on it.

I am using .NET 2003.

Regards
Simon Jefferies
Tools Programmer, Headfirst Productions
mailto:si****@headfirst.co.uk
-
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uY**************@TK2MSFTNGP11.phx.gbl...
Simon,
*Simon Jefferies < SI **** @ headfirst.co.uk> scripsit:
Simon,

* "Simon Jefferies" <si****@headfirst.co.uk> scripsit:
我正在尝试将一个项目添加到一个选中的列表框中,例如:

clbList.Items.add(" Hello",true)

我收到错误:

抛出运行时异常:System.ArgumentOutOfRangeException - 指定的
参数超出了有效值的范围。参数名称:'' - 1''不是
索引的有效值。

这不是很有意义吗?有什么想法会发生这种情况吗?
I am trying to add an item to a checked list box, like:

clbList.Items.add("Hello",true)

I get an error back:

Run-time exception thrown: System.ArgumentOutOfRangeException - Specified
argument was out of the range of valid values. Parameter name: ''-1'' is
not a
valid value for index.

This doesn''t make a lot of sense? Any ideas why this happens?



我无法重现这一点。你确定这条线会抛出
异常吗?您使用的是哪个版本的.NET?

- Herfried K. Wagner [MVP]
< URL:http://dotnet.mvps.org/>



I am not able to repro that. Are you sure this line throws the
exception? Which version of .NET do you use?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>



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

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