如何从ListBox中读取字符串?

limlzm 2003-11-04 03:12:16
如果ListBox中有如下选项 one
two
three
如果我用鼠标点取two的时候,我怎样获得two这个字符串?
...全文
116 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
limlzm 2003-11-05
  • 打赏
  • 举报
回复
结账:具体实现是
AnsiString str;
int b=ListBox1->ItemIndex;
str = ListBox1->Items->Strings[b];
str就是你要的数值
这里的人居然没一个答对,我想大概是因为他们轻敌了,很多都把Strings当成String,不过能得到大家的提示,最终能解觉还是要感谢大家的帮忙。
踏岸寻柳 2003-11-04
  • 打赏
  • 举报
回复
ShowMessage( ListBox->Items->String[ListBox->ItemIndex] );
andy_qhz 2003-11-04
  • 打赏
  • 举报
回复
AnsiString str;
int b=ListBox1->ItemIndex;
str = ListBox1->Items->String[b];
str就是你要的数值
fatwave 2003-11-04
  • 打赏
  • 举报
回复
ListBox->Items->String[ListBox->ItemIndex];
limlzm 2003-11-04
  • 打赏
  • 举报
回复
更正一下,我是用b=ListBox1->ItemIndex;来获得他的项数,我想通过项来获取字符串

13,824

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧