Question I want to print at the end of text in Textbox

Mangore

Member
Joined
Jan 5, 2012
Messages
17
Programming Experience
Beginner
I have TextBox including text Example "Hello". I want to print another text like "Vb.net" at the end of hello to became like this : "Hello Vb.net"
 
Displaying text in a TextBox is not printing. Printing is sending data to a printer to be printed onto paper, or at least to a printer driver. Displaying text in a TextBox is just displaying text in a TextBox. If you want to add text to the end, i.e. append text, then you would call the AppendText method of the TextBox.

Here's a tip that will help you learn lots and require you to post much less: when you are using a new type and there's something you don't know how to do, always start by reading the MSDN documentation for that type. If you had done so in this case then you would have seen that the TextBox has an AppendText method and you'd know that that was what you needed to use without having to post here. You'd also have learned a lot more about the TextBox class that will come in handy in the future. I'm not saying that you shouldn;t post on forums like this one, but they should never be more than third option, after reading the relevant documentation and a web search. If you have something complex that does require a forum post then some, like myself, will often provide the name of the appropriate type or member to make use of rather than just posting code to copy and paste, so you can then read the appropriate documentation for that type or member and most likely write the code for yourself. Follow this advice and you'll become the best developer you can be much sooner. Don't be afraid to post on forums when you can't find what you need or don't understand what you find, but always look first and ask questions later.
 
TextBox1.AppendText(TextBox2.Text) succeed with me
By the way I did that way you said by serach then ask in the forum, but I don't know the AppendText method, so I don't know how to search.
Another question please. can I clear text in textbox starting from character. example: if I have this text " Hell@Vb.net" can I clear the text from @ to end of text to became like this "Hello"

I'm sorry for bad language( Print .. Display) because it's not my native language
Thank you for help !!!
 
Mangore said:
By the way I did that way you said by serach then ask in the forum, but I don't know the AppendText method, so I don't know how to search.
Actually that was not suggestion, it was:
jmcilhinney said:
always start by reading the MSDN documentation for that type
The type in question is TextBox class, and documentation can be found at MSDN Library here: TextBox Class

Mangore said:
can I clear text in textbox starting from character. example: if I have this text " Hell@Vb.net" can I clear the text from @ to end of text to became like this "Hello"
To do that you have to work with the text, which in VB is represented by String type, have a go at the documentation for that type here first: String Class
 
I found the Method that can specific the character ( @) it is Contains . and found the Method to remove the Character from specific place to end of text it is Remove
But the method Remove only remove specific by arrangement of char in text. I tried a condition like: " if there is this char @ . specific the arrangent of it in text and then remove it to end of text". but I don't know how to do it.
 
Remove method requires an index, check out the various methods that contains the word 'Index'.
 
 Dim testString As String = "Hello@Vbnet"
        Dim index As Integer = testString.IndexOf("@")
        testString = testString.Remove(index)
        MsgBox(testString)'it will show Hello

How to sign this thread as resolved?
Thank you for help!!
 
Back
Top