SolvedChanging 1 Character in a label

Posts 1–6 of 6 · Page 1 of 1
Changing 1 Character in a label
God i cannot remember how to do this its been a while now
Im trying to change Characters in a label

for example
Code:
Public Sub myshitcode()
    If label1.Text.Contains("/") Then
    
     label1.Text.Replace("/","\")
    
    End If

End Sub
i dont understand why thats not replacing the Character lol
i have even tried this

Code:
Public Sub myshitcode()
   Dim a As Char =  "/"
   Dim b As Char =  "\"
   label1.Text.Replace(a,b)  
End Sub
neither way works
I have done this in the past I just cant Remember how nor find any of my Snippets.

So can someone please help that would be great
.Replace() does not change the object (string), but returns one modified...

label1.text = label1.text.replace....
In other, words
Code:
TextBox1.Text = TextBox1.Text.Replace("A", "B")
Quote Originally Posted by DawgiiStylz View Post
In other, words
Code:
TextBox1.Text = TextBox1.Text.Replace("A", "B")
o that makes perfect sense now no wonder it wasnt doing anything
lol
so then i would be able to do it like this then right

Code:
Public Sub myshitcode()
    If label1.Text.Contains("/") Then
    
     label1.Text = label1.Text.Replace("/","\")
    
    End If

End Sub
ill try this tonight
Quote Originally Posted by XiAtomikiX View Post
o that makes perfect sense now no wonder it wasnt doing anything
lol
so then i would be able to do it like this then right

Code:
Public Sub myshitcode()
    If label1.Text.Contains("/") Then
    
     label1.Text = label1.Text.Replace("/","\")
    
    End If

End Sub
ill try this tonight
That should work just fine.Don't forget how to execute the sub too
hey thanks guys it works great now.

Mark as Solved please thanks
Posts 1–6 of 6 · Page 1 of 1

Post a Reply

Similar Threads

Talk with us