Results 1 to 8 of 8

Thread: masked text box [RESOLVED]

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489

    masked text box [RESOLVED]

    is there a masked text box control specifically written in VB.NET along with the source code? I'd like to get my hands on it and learn how it works. I saw the one written in c++ on codeproject.com but I don't have that language installed (or know a lot about it)
    Last edited by Andy; Feb 11th, 2004 at 09:35 PM.

  2. #2
    Fanatic Member
    Join Date
    Jul 2003
    Posts
    830
    Are you talking about the "PasswordChar" of a text box.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    not exactly. I need a control that will automatically format a phone number for me.

  4. #4
    Fanatic Member
    Join Date
    Jul 2003
    Posts
    830
    This might be a sneaky way of doing it, but it seems to work. Of course it is far from perfect, but it can proabably be played with a bit by the experts to come up with a relatively simple solution. See the attached zip file.

    Basically, there are two textboxs (1 and 2). textbox2 is disabled at startup and is on top of textbox1. When textbox1's text changes then the below occurs. Of course, you don't get the blinking cursor in textbox2 so the user doesn't know they are there, but you can click in textbox2 and backspace and you can highlight the phone number (although you do not see it) and backspace and retype it. Like it said it might could be played with.

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles TextBox1.TextChanged

    Dim i As Integer
    Dim j As Integer
    Dim k As Integer
    Dim AreaCode As String
    Dim Prefix As String
    Dim LastFour As String

    'Phone number format = (555) 555-5555

    For i = 1 To 3
    AreaCode = Mid(TextBox1.Text, 1, i)
    Next i

    For j = 1 To 3
    Prefix = Mid(TextBox1.Text, 4, j)
    Next j

    For k = 1 To 4
    LastFour = Mid(TextBox1.Text, 7, k)
    Next k

    TextBox2.Text = "(" & AreaCode & ")" & " " & Prefix & "-" & LastFour

    End Sub
    Attached Files Attached Files
    Last edited by birthjay; Jan 30th, 2004 at 12:30 AM.

  5. #5
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224

    masked text box

    Hi,

    I attached a file: ValidText.dll

    It is working like MaskEdBox

    simply put it on your form
    and change the properties of the MaskEdit

    Have a nice day
    Attached Files Attached Files

  6. #6
    Fanatic Member
    Join Date
    Jul 2003
    Posts
    830
    How do you add it?

  7. #7
    Addicted Member
    Join Date
    Aug 2002
    Posts
    224
    Hi,

    From the ToolBox drag and drop

    But first add to your ToolBox
    from .net framework componets

    Have a nice day

  8. #8
    Fanatic Member
    Join Date
    Jul 2003
    Posts
    830
    Got it. Maybe I will be able to do things like that one day.

    I right-clicked on the TooBox - Browsed for the validtext.dll under the .NET Component tab and added it. After confirming it was there and in the Toolbox, I ran the project and was then able to change the properties of MaskEdit to (###) ###-####

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width