如何在C#和WinForms中将项目添加到列表框?

编程入门 行业动态 更新时间:2024-10-08 08:32:24
本文介绍了如何在C#和WinForms中将项目添加到列表框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我在弄清楚如何将项目添加到在WinForms中是 ListBox 。

I'm having trouble figuring out how to add items to a ListBox in WinForms.

我尝试过:

list.DisplayMember = "clan"; list.ValueMember = sifOsoba;

如何将 ValueMember 添加到列表中 int 的值和 DisplayMember 的一些文本?

How can I add ValueMember to the list with an int value and some text for the DisplayMember?

list.Items.add(?)

顺便说一句。出于任何原因,我都无法使用 ListBoxItem 。

推荐答案

list.Items.add(new ListBoxItem("name", "value"));

ListBox的内部(默认)数据结构为 ListBoxItem 。

The internal (default) data structure of the ListBox is the ListBoxItem.

更多推荐

如何在C#和WinForms中将项目添加到列表框?

本文发布于:2023-11-11 08:40:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1577915.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中将   项目   如何在   列表   WinForms

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!