travisowens Posted February 11, 2004 Posted February 11, 2004 What I want to do is have a textbox control that will contains a phone number from the data enterer. What I'm envisioning is a textbox with some formatting (in grey) that displays with the x's "(xxx)xxx-xxxx" So that a user can just type 1234567890 and the numbers will automatically go into the proper spot. After doing a little research it seems I need to use a MaskEdit which I grabbed the COM component that comes in Visual Studio but I don't understand how to apply the formatting although I have seen the format I need is (000)000-0000 but I can't find any tutorials or info on the subject with the exception of http://www.evermap.com/maskedit.htm How do I apply this InputMask (I don't see any property in the intellisense). Quote Experience is something you don't get until just after the moment you needed it
I Schobert Posted February 11, 2004 Posted February 11, 2004 You could try something like this during Form Load or even better during the Initialization of the form: Sub InitMedDate() With Me.medDate 'This box will hold date information. .Mask = "##/##/##" .Text = "12/01/99" 'The user likes bold Arial font at double the default. 'Double the size of the control to fit. .FontName = "Arial" .FontBold = True .FontSize *= 2 .Height *= 2 .Width *= 2 End With End Sub 'This is straight from the VS.NET Help, in your case the .Mask would be = "(###)###-####" Hope this helps... Quote IS
travisowens Posted February 11, 2004 Author Posted February 11, 2004 Big thanks I Schobert.... I kept trying to do mskPhone.Mask("(###)###-####"); when I just needed to do mskPhone.Mask = "(###)###-####"; Now it works... Does anybody know how to make the underscores not appear, or set them to white so they match the control's background? Quote Experience is something you don't get until just after the moment you needed it
I Schobert Posted February 11, 2004 Posted February 11, 2004 Travis, Thanks for the Thanks :) I don't have an input mask in fromt of me, but as much as I remember you can specify the placeholder character in the properties (I might be wrong). In this case, specify the spacebar char (just a space). Hope it works, Quote IS
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.