Masked Edit Box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MiziaQ
    New Member
    • Nov 2007
    • 63

    Masked Edit Box

    In my project I need the user to type in the following input:

    9999999A

    where the first 7 digits must be only digits,
    and the last character must be a letter from a-z ONLY

    I am using # for the first 7 digits,
    which character do I have to use to allow to enter only letters ?

    Thanks in advance :)

    MiziaQ
  • jamesd0142
    Contributor
    • Sep 2007
    • 471

    #2
    many people disagree with me, but i personally advise the mid function...

    mid(string,star t character, length)

    so capture first 7
    [code=vbnet]
    dim str as string
    str = 9999999A
    dim a as string
    a = mid(str,1,7)
    [/code]

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Originally posted by jamesd0142
      many people disagree with me, but i personally advise the mid function...
      Sorry James, but I think you misunderstood the question. MiziaQ, according to the documentation you use a question mark (?).

      Comment

      • AHMEDYO
        New Member
        • Nov 2007
        • 112

        #4
        HI..

        i think that you can use Key_Press Event to control what type of charatcers user can input asscoiated by Length of your TextBox Control and TextBox.SelStar t Property, for example you can allow only digits if the textbox length less than 7 and allow characters from a-z if the length=7 and selstart=6, you can try something like that



        Best Regards

        Edit : sorry i was have miss understand about your question, wrong answer.
        Last edited by AHMEDYO; Nov 22 '07, 06:32 AM. Reason: Wrong Answer

        Comment

        • lotus18
          Contributor
          • Nov 2007
          • 865

          #5
          Originally posted by MiziaQ
          In my project I need the user to type in the following input:

          9999999A

          where the first 7 digits must be only digits,
          and the last character must be a letter from a-z ONLY

          I am using # for the first 7 digits,
          which character do I have to use to allow to enter only letters ?

          Thanks in advance :)

          MiziaQ

          If you're using MaskedBox try this :

          [code=vb]
          MaskedBox1.Mask = #######?
          [/code]

          Comment

          • MiziaQ
            New Member
            • Nov 2007
            • 63

            #6
            Originally posted by AHMEDYO
            HI..

            i think that you can use Key_Press Event to control what type of charatcers user can input asscoiated by Length of your TextBox Control and TextBox.SelStar t Property, for example you can allow only digits if the textbox length less than 7 and allow characters from a-z if the length=7 and selstart=6, you can try something like that



            Best Regards

            Edit : sorry i was have miss understand about your question, wrong answer.
            Hey, could you please give me the code example for that. It would help a great deal :)

            Comment

            • lotus18
              Contributor
              • Nov 2007
              • 865

              #7
              Originally posted by MiziaQ
              Hey, could you please give me the code example for that. It would help a great deal :)
              Don't ask for a code. Just try to do it with your own. If you have some questions regarding about your code that's the time you can ask for our help. : )

              Comment

              • Killer42
                Recognized Expert Expert
                • Oct 2006
                • 8429

                #8
                I think you're better off sticking with the masked edit control, rather than trying to do it yourself in a textbox.

                Comment

                Working...