2016-12-30 31 views

回答

-1

試試這個:如果你想如果你想刪除一些數量刪除最後一個字

Dim words AS String() = YourTextBox.Text.Split(" "c) 
YourTextBox.Text = String.Join(" ", words.Take(words - 1)) 

MyString = TextBox1.Text 
If 5 > MyString.Length Then 
    TextBox1.Text = MyString.SubString(5, str.Length - 5) 
End If 
+0

謝謝先生:) – Hexadecimal

+0

不客氣! – user7777777

+0

嗯我無法在投票人 – Hexadecimal

3

MyString = TextBox1.Text 
TextBox1.Text = MyString.Left(MyString.Length - 5) 

如果Left不起作用,試試這個最後的字符

Dim amountToRemove As Integer = 5 
YoutTextBox.Text = YoutTextBox.Text.Remove(YoutTextBox.Text.Length - amountToRemove) 

或LINQ方法

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) 
相關問題