|
-
Jul 28th, 2000, 08:15 PM
#1
Thread Starter
Frenzied Member
on text1.text, I have 5 characters, how can I check to make sure that none of them are the same
like:
Code:
if text1.text include 2 same characters then
bla bla bla
else:
bla bla bla
how do I get it work?
NXSupport - Your one-stop source for computer help
-
Jul 28th, 2000, 08:59 PM
#2
Hyperactive Member
You may try:
For c = 1 to Len(Text1.Text) - 1
If Instr(Mid$(Text1.Text, c+1), Mid$(Text1.Text, c, 1)) <> 0 Then
' Found 2 or more
Else
' Not Found
End If
Next
Hope this is what you want
-
Jul 28th, 2000, 09:14 PM
#3
Thread Starter
Frenzied Member
NXSupport - Your one-stop source for computer help
-
Jul 28th, 2000, 11:20 PM
#4
transcendental analytic
That is significantly slow method, you could use Like operator:
Code:
'In declarations
Option Compare Text
'In code
For X=65 to 90
IF Text1.Text Like "*" & chr(x) & "*" & chr(x) & "*" Then
Msgbox "Contains 2 same characaters"
Exit For
End if
Next X
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jul 29th, 2000, 07:18 AM
#5
_______
<?>
kedaman's solution is perfect, as long as there is only alpha data in the textbox...doesn't work with numbers as their dec value is not included.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 29th, 2000, 10:18 AM
#6
Thread Starter
Frenzied Member
well accutually I have numbers and letters
NXSupport - Your one-stop source for computer help
-
Jul 29th, 2000, 04:16 PM
#7
transcendental analytic
You can change For X=whatever to whatever, you can even exclude some characters if you make an array of x values
Code:
'In declarations
Option Compare Text
'In code
For X=48 to 90
IF Text1.Text Like "*" & chr(x) & "*" & chr(x) & "*" Then
Msgbox "Contains 2 same characaters"
Exit For
End if
Next X
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jul 29th, 2000, 04:23 PM
#8
Thread Starter
Frenzied Member
thanks, but all ready made everything using the other medthods, but thanks anyway
NXSupport - Your one-stop source for computer help
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|