[英]how to loop through a string and create an array? - VB.NET
可以这么说,我在创建模板的地方有一个字符串。
{
Dim myvariable as string
Richtextbox1.text = Richtextbox1.text & "The dog jumped over the" & myvariable & "to find the fox."
}
我有一个列表框,其中包含加载到变量示例中的选项列表:fence,bucket等。
所以句子看起来像
现在,我已将其编码为显示在富文本框中,但是所有内容都在同一个富文本框中。
我试图以这种方式在每个循环的末尾将字符串加载到数组中,然后将每个句子分开。
什么是做到这一点的最好方法是什么?
谢谢
假设您的ListBox控件的名称是myLstBox
而RichTextBox控件的名称是myRchBox
Private Sub WriteOnRichTextBox()
For Each xStr As String In myLstBox.Items
myRchBox.AppendText("The dog jumped over the " & _
xStr & " to find the fox.")
myRchBox.AppendText(ControlChars.NewLine)
Next
End Sub
您需要循环查看列表框中找到的所有项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.