c#中windows应用程序中的列表框 [英] listbox in windows application in c#
本文介绍了c#中windows应用程序中的列表框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有列表框,我添加项目投放数据源
如何从列表框中选择项目
i have listbox, and i add items threw datasource
how can i get selected item from listbox
推荐答案
Quote:
如何从列表框中选择项目
how can i get selected item from listbox
你可以得到使用 ListBox.SelectedItem属性从列表框中选择项目[ ^ ]
如果选择了多个项目,请使用 ListBox.SelectedItems属性 [ ^ ]
希望这有帮助。
You can get the selected item from the list box using the ListBox.SelectedItem Property[^]
And if more than 1 items are selected, use the ListBox.SelectedItems Property[^]
Hope this helps.
尝试:
Try:
Console.WriteLine(myListBox.SelectedItem);
或者处理SelectedIndexChanged或SelectedValueChanged事件并在那里拿起它。
Or handle the SelectedIndexChanged or SelectedValueChanged events and pick it up there.
这篇关于c#中windows应用程序中的列表框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文