It's because the Text property includes the "masked out" characters that the user is expected to fill in.
Try the
MaskedTextBox.MaskCompleted[
^] property instead.
"i did mtxtime.maskcompleted = false and it works
but the problem, i have a combobox where a specific item is selected, the masktextbox should be disabled automatically. however, when im doing what you told me, it is not letting me save now as it is recognising that the masttextbox is blank even disabled.
Enter your reply below and click the Submit button."
Yes, MaskCompleted is a bool, so you have to check it as such.
If you have disabled it, then you need to add the check for that into your expression.
If cboselect.SelectedIndex = -1 Or nuddigits.Value = 0 Or String.IsNullOrEmpty(textbox1.Text) Or Not mxttime.Enabled Or Not mxTtime.MaskCompleted Then
"No its the same. Ok, I will explain well.
I have a combobox which has 3 items namely Red, Blue, Black and Green. When Red or Blue is selected, the maskedtextbox is disabled else it is enabled for the other colours if selected.
when I select Red or Blue, the maskedtextbox is disabled, good, but the problem is I still can't save as even disabled when selected these colours, i get the message box to prompt me to fill it."
So? That's just a case of getting the logic right in your
if
condition:
If cboselect.SelectedIndex = -1
Or nuddigits.Value = 0
Or String.IsNullOrEmpty(textbox1.Text)
Or (mxttime.Enabled And Not mxTtime.MaskCompleted)
Then
(I broke the lines up so you can see them a bit more easily)