|
-
Oct 21st, 2011, 01:05 AM
#1
Thread Starter
New Member
[RESOLVED] How do I get a combo box to add text to a text box?
Please remove this thread. I solved my own question.
Last edited by i like pizza; Oct 21st, 2011 at 01:12 AM.
-
Oct 21st, 2011, 06:56 AM
#2
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.
-
Oct 21st, 2011, 10:09 AM
#3
Thread Starter
New Member
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.
-
Oct 21st, 2011, 10:28 AM
#4
Re: [RESOLVED] How do I get a combo box to add text to a text box?
 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
-
Oct 21st, 2011, 10:35 AM
#5
Thread Starter
New Member
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?
-
Oct 21st, 2011, 01:34 PM
#6
Re: [RESOLVED] How do I get a combo box to add text to a text box?
 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....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|