DropDownList和ListItem [英] DropDownList and ListItem
问题描述
对不起我的愚蠢问题......
与我们在DropDownList中定义的ValueMember相同。和
显示会员当我们绑定DatasSource时,我怎么能使用
硬编码固定数据源(没有访问数据库或创建一个
DataTable)?
为了尽可能清楚,如果我想在数据后面填充一个带有
的DropDownList(不是来自数据库,而是来自我的源代码),怎么做
我呢?
ID - Desciption
3 - 描述3
6 - 描述6.1
7 - 说明7
使用ASP.NET我使用ListItem但似乎不能使用Windows窗体。
亲切的问候,
Fabio Negri Cicotti
软件工程师
Sorry for my silly question...
in the same way we can define in a DropDownList the "ValueMember" and
"Display Member" when we bind a DatasSource, how could I do it using a
hard-code fixed datasource (without neither access the DB or create a
DataTable)?
To be as clear as possible, if I want to fill a DropDownList with the
following data (not comming from database, but from my source-code), how do
I do?
ID - Desciption
3 - Desc 3
6 - Desc 6.1
7 - Desc 7
With ASP.NET I use ListItem but it seems don''t work with windows forms.
Kind regards,
Fabio Negri Cicotti
Software Engineer
推荐答案
Fabio,
DropDownList在Windows窗体中不存在。我假设你的意思是
ComboBox控件。在这种情况下,你将使用Items属性,这是该类的索引器(我相信)
。
希望这会有所帮助。
-
- Nicholas Paldino [.NET / C#MVP]
- mv*@spam.guard.caspershouse.com
Fabio Negri Cicotti [MCP]" < CI ***** @ hotmail.com>在消息中写道
news:e
Fabio,
The DropDownList doesn''t exist in Windows Forms. I assume you mean the
ComboBox control. In this case, you would use the Items property, which is
the indexer (I believe) for the class.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Fabio Negri Cicotti [MCP]" <ci*****@hotmail.com> wrote in message
news:e
************** @ TK2MSFTNGP14.phx.gbl ...
**************@TK2MSFTNGP14.phx.gbl...
对不起我的愚蠢问题......
我们可以在DropDownList中定义ValueMember。和
显示会员当我们绑定DatasSource时,我怎么能使用
硬代码固定数据源(没有访问数据库或创建数据表)?
要清楚尽可能,如果我想用下面的数据填充DropDownList(不是来自数据库,而是来自我的源代码),我该怎么做?
ID - Desciption
3 - Desc 3
6 - Desc 6.1
7 - Desc 7
使用ASP.NET我使用ListItem但似乎不能使用窗口表格。
亲切的问候,
Fabio Negri Cicotti
软件工程师
Sorry for my silly question...
in the same way we can define in a DropDownList the "ValueMember" and
"Display Member" when we bind a DatasSource, how could I do it using a
hard-code fixed datasource (without neither access the DB or create a
DataTable)?
To be as clear as possible, if I want to fill a DropDownList with the
following data (not comming from database, but from my source-code), how
do I do?
ID - Desciption
3 - Desc 3
6 - Desc 6.1
7 - Desc 7
With ASP.NET I use ListItem but it seems don''t work with windows forms.
Kind regards,
Fabio Negri Cicotti
Software Engineer
Fabio,
我应该纠正自己,Items不是索引器,但你仍然会使用该属性(它公开一个集合)来添加项目清单。
-
- Nicholas Paldino [.NET / C#MVP]
- mv*@spam.guard.caspershouse.com
" Fabio Negri Cicotti [MCP] QUOT; < CI ***** @ hotmail.com>在消息中写道
news:e
Fabio,
I should correct myself, Items is not the indexer, but you would still
use that property (it exposes a collection) to add items to the list.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Fabio Negri Cicotti [MCP]" <ci*****@hotmail.com> wrote in message
news:e
这篇关于DropDownList和ListItem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!