Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27189

VS 2010 Remove a specific character from a string

$
0
0
Okay, so I'm trying to validate a string which is a name so that it the user accidently entered a space at the end or beginning it'll remove it.

I have this code
Code:

       
If ClientNameBox.Text.Contains(" ") Then
            Dim Characters As Array
            MsgBox("THIS")
            Characters = ClientNameBox.Text.ToCharArray
            For Each character In Characters
                If character = " " Then
                    character = ""
                End If
            Next
            ClientNameBox.Text = Characters.ToString


This just displays System.char[]
Any ideas, first time doing this so if it's something easy I'm very sorry.

Viewing all articles
Browse latest Browse all 27189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>