How to use a Masked textbox for C#time?

Asked

Viewed 339 times

3

I’m trying to create a Masked textbox that gets the time of a video. But I don’t know how to format the Masked textbox to get the time in HH:MM:SS:MMM. The value of the time I get from the video is a double. 1 sec = 1000. It’s a Windows Form

1 answer

2


Just add a Maskedtextbox and add a Custom Mask for him.

I think an image explains it better, so just do this:

inserir a descrição da imagem aqui

Any doubt can look at these references below:

Edit after comment

If you want to validate the value, there are a few ways to do this in TextBox, but I advise using the DateTimePicker, that already exists. Using it, just add a Custom Format in properties. Would look like this:

inserir a descrição da imagem aqui

  • But then it will be able to add any value, even if it is an invalid time. Example: 90:80:45.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.