Hello again!
Since you have raised this as a new question, I will reply here, rather than to your message(s).
You already know how to enable and disable the MaskedTextBox: set the MaskedTextBox.Enabled property to true or false.
Does your combo box contain combinations of Product, Size, and Cost?
I.e. do you have all the permutations in the Items the user can select?
Product
Size
Cost
Product and Size
Product and Cost
Size and Cost
Product, Size and Cost
If so, then probably the best way is via a Select statement:
Select Case cbOperation.SelectedText
Case "Product", "Size", "Cost", "Product and Cost", "Size and Cost"
tbCost.Enabled = False
Exit Select
Case "Product and Size", "Product, Size and Cost"
tbCost.Enabled = True
Exit Select
End Select
If not, then the user can't select a combination anyway... :laugh:
"Does not work dear, my codes below:
Private Sub cboType_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboType.SelectedIndexChanged
Select Case cboType.SelectedText
Case "Product", "Size"
mtxtCategory.Enabled = False
Exit Select
Case "Cost"
mtxtCategory.Enabled = True
Exit Select
End Select
After reading your code, (and trying it so I realize you need a cast), try this:
Select Case DirectCast(cbOperation.SelectedItem, String)
Case "Cost", "Product and Cost", "Size and Cost", Else
tbCost.Enabled = True
Exit Select
Case "Product", "Size", "Product and Size", "Product, Size and Cost"
tbCost.Enabled = False
Exit Select
End Select
You do realise that if your combo box only has the three items "Cost", "Product" and "Size" you cannot select a combination of "Product and Size", or "Product and Cost", don't you?
BTW: In western society, use of "dear" as an honorific (as in "Does not work dear,") is discouraged as it has sexist overtones. In this case I am male and take no offence, but you should be careful!