Combination of Capital letter, small letter, number and speacial character

how to detect the input (Text box) that user key in the word (string) are combination of Capital letter, small letter, number and speacial character?
tonyckxAsked:
Who is Participating?
 
sadcockConnect With a Mentor Commented:
Tonyckx-

Are you trying to detect wether the user pressed all of these keys at once?  Or in a series with each other?

If it is in a series, simply write code in the change event that interrogates the value of the textbox.

i.e.

private function textbox1_change()
   dim required(4) as integer
   dim x as long
   for x = 1 to len(textbox1.text)
      if mid(textbox1.text,x,1) = specchar then
         required(1) = 1
      else
         if mid(textbox1.text,x,1) = captial then
            required(2) = 1
         else
            if mid(textbox1.text,x,1) = lower then
               required(3) = 1
            else
               if mid(textbox1.text,x,1) = number then
                  required(4) = 1
               end if
            end if
         end if
      end if
   next

   If all required's are 1 then
      success
   else
      fail
   end if


P.s.  You would check for number, special char, etc...by using the ASC function against each character to get the ASCII value
0
 
tonyckxAuthor Commented:
Can you tell me how to check whether the input is specchar , captial ,lower and number.  Thanks
0
 
tonyckxAuthor Commented:
Adjusted points from 30 to 50
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
tonyckxAuthor Commented:
sadcock,
i use a textbox to give user key in  string of character.  when user click command button, a algorithm will check the input textbox. so how i want to write a algorithm to check the input are combination of Capital letter, small letter, number and speacial character? example if the input is:-
1)abcde (boolean = false because small letter only.)
2)1234  (boolean = false because number only)
3)!@#$  (boolean = false because special character only)
4)abc!@#123 (boolean = false because no capital letter)
5)!@#TonyCKX123 (boolean = true) combination of Capital letter, small letter, number and speacial character

can you give me some coding about the situation? thanks very much.

from tonyckx
0
 
tonyckxAuthor Commented:
Adjusted points from 50 to 60
0
 
tonyckxAuthor Commented:
sadcock,
How to detect a input of string contain a special character? Example

1)tonyckx!123 (Boolean = true)
2)computer (Boolean = false)
3)Nesw$ (Boolean = true)

pls help me!

Thanks.
0
 
tonyckxAuthor Commented:
Comment accepted as answer
0
 
tonyckxAuthor Commented:
Thanks sadcock.

from u comment, i get sulotion to solve my problem.

Thanks very much!

from
Tonyckx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.