i have a masked text box for phone numbers. i want to save the results as a double but it includes the parenthesis and dashes. what would be the best way to remove the mask and save only the numbers?
Printable View
i have a masked text box for phone numbers. i want to save the results as a double but it includes the parenthesis and dashes. what would be the best way to remove the mask and save only the numbers?
try this:
vb Code:
MaskedTextBox1.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals MsgBox(MaskedTextBox1.Text)
Phone numbers should not be saved as numbers. They should be saved as text because that's what they are. Do you ever plan to add or subtract two phone numbers?
good point i guess but does it really matter? it is all numbers so wouldn't it be logical to store it as a number?
not if it begins with a zero. it'll be truncated
good point. ah well then that settles it. i will store it as text. thanks.
now the question is should i save it with the mask or not?