2016-11-12 123 views
1

Okey ..這是一個代碼,或類似的東西。獲取所有項目的名稱,並將項目計入列表框中

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click 
    noselect = True 
    'dim-eli a KS-t(keres/kinalt) aszerint,hogy,mi van select-elve 
    If RadioButton1.Checked Then 
     ks = "Kínál" 
    Else 
     ks = "Keres" 
    End If 

    'count-ol -1-tol a listbox1.items.count-ig(pl 4) 


    kód.RichTextBox1.Text = "[hr][img]http://kepfeltoltes.hu/160512/seeadfix_www.kepfeltoltes.hu_.png[/img][hr][table]" & vbNewLine & 
     vbNewLine & "[tr][td][b][color=#7CC576]Név:" & vbNewLine & "[/td][td][b][color=white]" & TextBox1.Text & vbNewLine & "[/td][/tr]" & vbNewLine & 
     vbNewLine & "[tr][td][b][color=#7CC576]Elérhetőség:" & vbNewLine & "[/td][td][b][color=white]" & TextBox3.Text & vbNewLine & "[/td][/tr]" & vbNewLine & 
     vbNewLine & "[tr][td][b][color=#7CC576]Kínál/Keres:" & vbNewLine & "[/td][td][b][color=white]" & ks & vbNewLine & "[/color][/td][/tr]" & vbNewLine & 
    vbNewLine & "[tr][td][b][color=#7CC576]Megnevezés:" & vbNewLine & "[/td][td][b][color=white]" & TextBox4.Text & vbNewLine & "[/td][/tr]" & vbNewLine & 
    vbNewLine & "[tr][td][b][color=#7CC576]Képek:" 
    noselect = False 
    For l_index As Integer = 0 To (ListBox1.Items.Count - 1) 
     kód.RichTextBox1.Text += vbNewLine & "[img width=1280 high=720]" & --- & vbNewLine 

    Next 

    kód.Show() 

End Sub 

所以,我想要什麼: 我想這段文字kód.RichTextBox1.Text += vbNewLine & "[img width=1280 high=720]" & -)添加到我的kod.richtextbox,多次listbox1.items.count是。

回答

2

我猜你想實際上把列表框的內容放到你的文本框中。試着這樣說:

For i As Integer = 0 To ListBox1.Items.Count - 1 
    kód.RichTextBox1.AppendText(ListBox1.Items(i).ToString & Environment.NewLine) 
Next 

或For Each循環:

For Each s As String In ListBox1.Items 
    kód.RichTextBox1.AppendText(s & Environment.NewLine) 
Next 
相關問題