C
C#2y ago
olan4527

❔ 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
5 Replies
Anton
Anton2y ago
more context
olan4527
olan4527OP2y ago
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)
Anton
Anton2y ago
well then set the text property on the textbox you're setting dome global variable
Angius
Angius2y ago
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? If the latter, you'd run your replacing code on input
TextBox.Text = TextBox.Text.Replace(' ', '-');
TextBox.Text = TextBox.Text.Replace(' ', '-');
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server