按索引获取列表框项的值 [英] Get the value for a listbox item by index

查看:18
本文介绍了按索引获取列表框项的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这一定很容易,但我被卡住了.我有一个带有 X 项的列表框.每个项目都有一个文本描述(出现在列表框中)及其值(数字).我希望能够使用项目的索引号获取项目的 value 属性.

This must be very easy but I am stuck. I have a listBox with X Items. Each Item has a text description (Which appears in the listBox) and its value(numerical). I want to be able to get the value property of an item, using the index number of the item.

推荐答案

It would be

It would be

String MyStr = ListBox.items[5].ToString();

这篇关于按索引获取列表框项的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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