Pawn28,
Below is my old VB6 code, which you could probably turn into .NET. The code demonstrates 3 different ways to clear the box. Put 3 command buttons and one masked edit control on the form.
vladk
Private Const CLEAR_MASK As Long = 1
Private Const CLEAR_PROMPT_INCLUDE As Long = 2
Private Const CLEAR_REPLACE_PLACEHOLDERS As Long = 3
Public Sub ClearMaskEditBox(ByRef pMaskEdBox As MaskEdBox, ByVal plngHowToClear As Long)
Dim strMask As String
Dim blnPromptInclude As Boolean
Select Case plngHowToClear
Case CLEAR_MASK
With pMaskEdBox
strMask = .Mask
.Mask = vbNullString
.Text = vbNullString
.Mask = strMask
End With
Case CLEAR_PROMPT_INCLUDE
With pMaskEdBox
blnPromptInclude = MaskEdBox1.PromptInclude
.PromptInclude = False
.Text = MaskEdBox1.Mask
.PromptInclude = blnPromptInclude
End With
Case CLEAR_REPLACE_PLACEHOLDERS
With pMaskEdBox
.Text = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(.Mask, "&", .PromptChar), "#", .PromptChar), "?", .PromptChar), "A", .PromptChar), "a", .PromptChar), "9", .PromptChar), "C", .PromptChar), ">", vbNullString), "<", vbNullString)
End With
Case Else
ClearMaskEditBox pMaskEdBox, CLEAR_MASK
End Select
End Sub
Private Sub Command1_Click()
ClearMaskEditBox MaskEdBox1, CLEAR_MASK
End Sub
Private Sub Command2_Click()
ClearMaskEditBox MaskEdBox1, CLEAR_PROMPT_INCLUDE
End Sub
Private Sub Command3_Click()
ClearMaskEditBox MaskEdBox1, 6 'CLEAR_REPLACE_PLACEHOLDERS
End Sub