Removing characters in textbox [vb.net]
I use a button to locate a file, and it puts the location in the textbox as "C:\file.exe\" I need the "" so when a user select a folder with a space in it it won't see it as a new input.
OpenFileDialog1.ShowDialog()
Dim filename As String = OpenFileDialog1.FileName
TextBox1.Text = Chr(34) & filename & Chr(34)
But lat开发者_运维技巧er I need the same location of the textbox but without the "" (Chr(34))charachters. How can I make it so it removes those characters out of the textbox?
You can remove any set of characters from a string using the .Replace method.
Dim text = TextBox1.Text.Replace(Chr(34).ToString(),String.Empty)
TextBox1.Text = text
精彩评论