简体   繁体   English

如何获取列表框索引

[英]How to get listbox index

This is an item on my listbox.这是我列表框中的一个项目。 After I press a button, it adds this to my listbox and I want to get the hh:mm index (10:58), but I think this only has one index.在我按下一个按钮后,它会将它添加到我的列表框中,我想获得 hh:mm 索引(10:58),但我认为这只有一个索引。 How can I do it?我该怎么做?

This is the whole item:这是整个项目:

列表框项图像

You can use DataGridView instead.您可以改用 DataGridView。

You can add columns (like your time hh:mm) and then get the current selected index time.您可以添加列(例如您的时间 hh:mm),然后获取当前选定的索引时间。 Or you can get the selected index row string and code an algorithm to extract the hh:mm from your string.或者,您可以获取选定的索引行字符串并编写算法以从字符串中提取 hh:mm。

You could try and create an array with all the items that are inside the listbox, and from there, do whatever you want with it.您可以尝试使用列表框中的所有项目创建一个数组,然后从那里做任何您想做的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM