add selected item from listbox to textbox but do not remove text after from textbox after i add from listbox

StackOverflow https://stackoverflow.com/questions/23434538

  •  14-07-2023
  •  | 
  •  

Вопрос

Example what i want so if i type some keywords to textbox i do not it remove text from textbox when click on listbox and add that selected item to textbox but only after keywords and do not remove them both just leave as it is ?

How can you do that ?

this is code i have for so far.

Private Sub ListBox2_SelectedIndexChanged(ByVal sender As System.Object, 
        ByVal e As System.EventArgs) Handles ListBox2.SelectedIndexChanged
        TextBox1.Text = ListBox2.SelectedItem
End Sub

Thanks.

Это было полезно?

Решение

Private Sub ListBox1_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ListBox2.SelectedIndexChanged
    TextBox1.Text += ListBox2.SelectedItem
End Sub

Add the plus sign before equals to the += sign is an Add AND assignment operator, It adds right value to the left value and assigns the result to left value

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top