Answer
Ove
rf
low
Sign In With Discord
C#
help
Join
Root Question Message
Olan
12/29/2022
❔ Replace space with Hyphen in a text box as i type
Hi can someone please help i have tried this MyGlobalVarables.ProjectName = textBox1.Text.Replace(" ","-"); but it is not working
AntonC
12/29/2022
more context
Olan
12/29/2022
Hi i have a textbox on a form i want the text box to replace the space character with a hyphen when i type like (abc-def-123)
AntonC
12/29/2022
well then set the text property on the textbox
AntonC
12/29/2022
you're setting dome global variable
Angius
12/29/2022
Do you just want the output to be with hyphens instead of spaces? or do you want the hyphens to also show in that texbox?
Angius
12/29/2022
If the latter, you'd run your replacing code on input
Angius
12/29/2022
TextBox.Text = TextBox.Text.Replace(
' '
,
'-'
);
Contact
Frequently Asked Questions
Join The Discord
Bugs & Feature Requests
Terms & Privacy