|
-
Feb 9th, 2012, 07:38 PM
#1
Thread Starter
New Member
Strings
Hi everyone,
this is my first post to this forum.
Currently, I am a full time student hoping to graduate in June with a two year degree.
One of the classes I am taking is Visual Basic 2 and am having a bit of trouble with strings. Here is the click event I have so far. The red text is the problem spot. My instructor thought it should work.
Private Sub displayButton_Click(sender As System.Object, e As System.EventArgs) Handles displayButton.Click
Dim number As String
number = numberTextBox.Text.Trim
' count how many characters in the string
Dim numChars As Integer = number.Length
numChars = numChars - 1
' start loop using the total number of characters
For lp As Integer = 0 To numChars
' search string to examine if character
' is a hyphen, space or parentheses
If number.Substring(lp) Like "[- ()]" Then number = number.Remove(lp, 1)
Next
numberLabel.Text = number
End Sub
Can anyone tell me why this isn't working? I am stumped.
Thanks!
Joe.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|