【问题标题】:How to Get Specific Line from a ListBox Based on Integer如何从基于整数的列表框中获取特定行
【发布时间】:2014-02-08 12:03:55
【问题描述】:

我这里有一个非常基本的列表框,我想根据 listbox1.items.count 从特定行获取文本;因为那是一个整数

如何获取与该整数对应的行(本身,行号),并将列表框的该行存储到字符串RecentPlayer中?

Ex.

 Line #    ListBox Contents

 Line 0    Some String

 Line 1    Some Other

 Line 3    Something Else

【问题讨论】:

  • 请提供填充列表框的代码
  • 真的很长.......
  • 但这里只有一行playerList.Items.Add(player.Info.Rank.Name + " - " + player.Name);

标签: c# string listbox integer int


【解决方案1】:
string value = playerList.Items[index].ToString();

【讨论】:

  • 我刚刚弄清楚如何在更新时正确执行 ToString() 选项:P
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-05-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多