In C#, I made a textbox that accept only numbers, but I want to make a code to accept a time in the following format: "\_\_\_\_:\_\_\_\_:\_\_\_\_" so that when the user writes part of it, it completes the missing with zeros;
Example:
The user writes: "\_2:12:\_3" it should complete it as "02:12:03".

Does anybody have this code?
['https://Stackoverflow.com/questions/41505915', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/7383939/']
I think the best would be to use the Replace() function in C# as follow:

```
string x = "this is an example of a string with a _ character";

string z = x.Replace('_', '0');

```
```
private void SearchBar_TextChanged(object sender, TextChangedEventArgs e)
        {
            int value = int.Parse(YourTextBox.Text);
            if (value<10)
            {
                YourTextBox.Text = "0" + value;
            }
        }

```

and Ofcourse you can add other logic like if the user enters more than 60 for the minutes textbox the text should be replaced with an empty string