Example: say i have a text box that has the text "visual basic" is there a way i can remove "basic" or even if i don't know the text is there a way i can remove the last 5 or more or less in the text box?
How do I remove the last 5, or more, or less characters in a textbox for vb.net
3.5k Views Asked by Hexadecimal At
        	2
        	
        There are 2 best solutions below
0
                
                        
                            
                        
                        
                            On
                            
                                                    
                    
                If you want remove last word
Dim words AS String() = YourTextBox.Text.Split(" "c)
YourTextBox.Text = String.Join(" ", words.Take(words - 1))
If you want remove some number of last characters
Dim amountToRemove As Integer = 5
YoutTextBox.Text = YoutTextBox.Text.Remove(YoutTextBox.Text.Length - amountToRemove)
Or LINQ approach
Dim amountOfCharactersToRemove As Integer = 5
Dim amountOfCharactersToTake = YourTextBox.Text.Length - amountOfCharactersToRemove 
Dim characters As Char() = YourTextBox.Text.
                                       ToCharArray().
                                       Take(amountOfCharactersToTake).
                                       ToArray()
YoutTextBox.Text = new string(characters)
                        
Try this:
If
Leftdoesn't work, try this: