Fill a multiline-textbox with all items in a combobox list

Asked

Viewed 242 times

-3

And you guys are fine ?

As I can Fill a textbox with all items in a combobox list in a textbox, and combobox items can be variables come from different places.

Stayed like this

Code :

 For Each Linha In objClasse.atividades_secundarias

        ComboBox1.Items.Add(Linha.code + " - " + Linha.text)

        For Each VARIAVEL_DE_STRING As String In ComboBox1.Items
            txt_atividades_secundarias_encontradas.Text &= VARIAVEL_DE_STRING & vbCrLf
        Next

2 answers

2


Solution:

For Each VARIAVEL_DE_STRING As String In ComboBox1.Items
    txt_atividades_secundarias_encontradas.Text &= VARIAVEL_DE_STRING & vbCrLf
Next

0

For Each item As String In ComboBox1.Items
    TextBox1.AppendText(item + Environment.NewLine)
Next

Or by using Stringbuilder

Dim text = New System.Text.StringBuilder()

For Each item As String In ComboBox1.Items
    text.AppendLine(item)
Next

TextBox1.AppendText(text.ToString())
  • Thanks to everyone who helped because I took -3 penalty in the post ? .

Browser other questions tagged

You are not signed in. Login or sign up in order to post.