gpt4 book ai didi

ASP.NET 在文本框中显示列表框中选定的项目

转载 作者:行者123 更新时间:2023-12-02 17:50:00 25 4
gpt4 key购买 nike

我正在尝试将列表框中的所有选定项目显示到文本框中。目前我正在执行以下操作但没有成功:

For i As Integer = 0 To lb_words.ListCount
If lb_words.Selected(i) = True Then
tb_text.Text &= " Presto"
End If
Next

应该发生的是,对于列表框(lb.words)中的每个选定项目,我希望将其附加到我的文本框。假设我的列表框包含 Apple、Orange 和 Banana,并且我选择 Apple 和 Banana,我的文本框文本应为“Apple Banana”...

我刚刚向 ASP.NET 做了 self 介绍,所以保持简单吧:D 谢谢。

最佳答案

试试这个:

Dim s as String = ""

For each x as ListItem in lb_words.Items
if x.Selected Then s &= x.Text & " "
Next

关于ASP.NET 在文本框中显示列表框中选定的项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/873944/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com