|
-
Jan 14th, 2011, 10:29 PM
#2
Re: from buttons to textbox
If you set the Text of a TextBox to 1, it will display 1, right? Now, if you set the Text to 2, what would you expect it to display? The TextBox always displays the contents of its Text property, so it will display 2. If you want to join the existing text with some new text, that's exactly what you have to do: get the current Text, join the new text to it and then assign that combined result to the Text property, which then gets displayed.
Even better, the TextBox class even has a method specifically to append text. It's named AppendText. I know you are a beginner but, regardless, you should ALWAYS read the documentation. You're using a TextBox. Read the documentation for the TextBox class. Looking down the list of members, you'd soon come across the AppendText method, described thusly:
Appends text to the current text of a text box.
Beginner or not, it should be fairly clear that that does exactly what you want.
If you don't find what you want in the documentation then haven't really lost anything, other than a few minutes looking. If you do find it then it's a win, and you may find other useful information besides.
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
|