[RESOLVED] How do I get a combo box to add text to a text box?
Please remove this thread. I solved my own question.
Re: [RESOLVED] How do I get a combo box to add text to a text box?
Please do not remove your question simply because you solved it yourself. By doing so you are potentially depriving others from the solution.
If you had this problem chances are so did, or will, someone else.
Rather than remove your question, please post your solution (and put your question back).
Thanks. :)
Re: [RESOLVED] How do I get a combo box to add text to a text box?
Okay, here's what I did.
I created ComboBox11 and TextBox19. I put several strings in the combo box.
In design mode, I clicked the combobox, and wrote this code....
Code:
Private Sub ComboBox11_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox11.SelectedIndexChanged
TextBox19.Text = TextBox19.Text + ComboBox11.Text
End Sub
When I run it, every time I choose a string from the combo box, it adds the string to the text box. I can create a large paragraph this way in the text box by adding one string at a time from the combo box.
Re: [RESOLVED] How do I get a combo box to add text to a text box?
Quote:
Originally Posted by
i like pizza
Okay, here's what I did.
I created ComboBox11 and TextBox19. I put several strings in the combo box.
In design mode, I clicked the combobox, and wrote this code....
Code:
Private Sub ComboBox11_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox11.SelectedIndexChanged
TextBox19.Text = TextBox19.Text + ComboBox11.Text
End Sub
When I run it, every time I choose a string from the combo box, it adds the string to the text box. I can create a large paragraph this way in the text box by adding one string at a time from the combo box.
The + operator is used for maths generally. The & operator is used for string concatenation. When adding the same value together you use +=.
vb Code:
Private Sub ComboBox1_SelectedIndexChanged()
Me.TextBox1.Text += Me.ComboBox1.Text
End Sub
Re: [RESOLVED] How do I get a combo box to add text to a text box?
Thanks Ident. What will happen if I leave it the way I did it?
Re: [RESOLVED] How do I get a combo box to add text to a text box?
Quote:
Originally Posted by
i like pizza
Thanks Ident. What will happen if I leave it the way I did it?
100% nothing...
More code = more noise,
do it other way be a better programmer....