this is what I have:
I dont know what to write to make sure that the number is 0 to 9Code:intnumber = 'what????
if text1.text = "dimava" & intnumber then
end
end if
Printable View
this is what I have:
I dont know what to write to make sure that the number is 0 to 9Code:intnumber = 'what????
if text1.text = "dimava" & intnumber then
end
end if
I believe you could just use, the IsNumeric function, if you just need to make sure it is a number
Hope this helps.Code:
'Looking for just 0-9, make sure the variable is just one
'character
Dim intnumber as long *1
If IsNumeric(intnumber)=true then
Do something
Else
Don't do something
end if
Try this.
Code:'Since the length of "Dimava" is 6 we get the length of Text1 and subtract 6.
Num = Right(Text1, Len(Text1) - 6)
If Val(Num) >= 0 And Val(Num) <= 9 Then
'It's between 0 and 9
End
End If
[Edited by Megatron on 07-28-2000 at 05:07 PM]
Dim x As String
x = Right(Text1, 4)
If Asc(x) < 80 Or Asc(x) > 89 Then
MsgBox "no number"
End If
You can also use a MaskedEdit box.
thanks to all now what if I want to have it:
ans also:Code:if text1.text = "dimava" & LOWER CASE LETTER then
end
end if
[code]
if text1.text = "dimava" & UPER CASE LETTER then
end
end if
[/code[
Try this.
Code:Char = Mid(Text1, 7, 1)
If Asc(Char) > 96 And Asc(Char) < 123 Then
'Letter is Lower Case
ElseIf Asc(Char) > 64 And Asc(Char) < 91 Then
'Letter is Upper Case
End If
thanks MegaTron
but whats the code for
if text1.text = "dimava" & LOWER CASE LETTER then
end
end if
what doI put in the lower case thing
do I need to refer to the other code that you gave me or do I just put it there?
(question is directed to megatron)
Sorry about that. Try it now.
Code:If Left(Text1, 6) = "dimava" Then
Char = Mid(Text1, 7, 1)
If Asc(Char) > 96 And Asc(Char) < 123 Then
'Letter is Lower Case
ElseIf Asc(Char) > 64 And Asc(Char) < 91 Then
'Letter is Upper Case
End If
End If
thanks
1 more question:
you have a bunch of numbers there, can you please tell me what it means, because I'm planning to use it in other programs too... and with other words and stuff
or if the numbers dont have anything to do with the text then please tell me
also... I want it to be like "dimava" & your uper case code & "a" & lower case code then
..........................
Try this.
The number's are representing the ASCII values for the characters. If it's greater than 64 (A = 65) and less than 91 (Z = 90) then it's uppercase. If it's grater than 96 (a = 97) and less than 123 (z = 123) then it's lowercase.Code:'If the first 6 characters of the string is dimava then
If Left(Text1, 6) = "dimava" Then
'Capture the 7th character
Char = Mid(Text1, 7, 1)
'Check if it's UpperCase
If Asc(Char) > 64 And Asc(Char) < 91 Then
'Letter is UpperCase
End If
'Capture the 8th character
Char = Mid(Text1, 8, 1)
'Check if it's LowerCase
If Asc(Char) > 96 And Asc(Char) < 123 Then
'Letter is LowerCase
End If
End If
This is what I need:
the first letter to be uppercase
the second letter to be #
the third to be a "a"
the forth to be a lower case
and
the fifth to be a 1
can you please give me the code for it
thanks
Sure. It's just a matter of putting things together.
[Edited by Megatron on 07-28-2000 at 06:45 PM]Code:If Left(Text1, 6) = "dimava" Then
'Capture the 7th character
Char = Mid(Text1, 7, 1)
'Check if it's UpperCase
If Asc(Char) > 64 And Asc(Char) < 91 Then
'Letter is UpperCase
End If
'Capture the 8th character
Char = Mid(Text1, 8, 1)
'Check if it's a Number
If Asc(Char) > 47 And Asc(Char) < 58 Then
'Character is a Number
End If
'Capture the 8th character
Char = Mid(Text1, 9, 1)
'Check if it's LowerCase
If Asc(Char) > 96 And Asc(Char) < 123 Then
'Letter is LowerCase
End If
'Capture the 8th character
Char = Mid(Text1, 10, 1)
'Check if it's a 1
If Char = "1" Then
'Character is a One
End If
End If
This is what I need:
the first letter to be uppercase
the second letter to be #
the third to be a "a"
the forth to be a lower case
and
the fifth to be a 1
can you please give me the code for it
What I ment wasthere is no Dimava in the string, and I need the first lettter of the string to be upercase
Do just put1? or I'm not sure please respond
thanks
Try it now.
Code:'Capture the 1st character
Char = Mid(Text1, 1, 1)
'Check if it's UpperCase
If Asc(Char) > 64 And Asc(Char) < 91 Then
'Letter is UpperCase
End If
'Capture the 2nd character
Char = Mid(Text1, 2, 1)
'Check if it's a Number
If Asc(Char) > 47 And Asc(Char) < 58 Then
'Character is a Number
End If
'Capture the 3rd character
Char = Mid(Text1, 4, 1)
'Check if it's an "a"
If Char = "a" Then
'Character is "a"
End If
'Capture the 4th character
Char = Mid(Text1, 3, 1)
'Check if it's LowerCase
If Asc(Char) > 96 And Asc(Char) < 123 Then
'Letter is LowerCase
End If
'Capture the 5th character
Char = Mid(Text1, 4, 1)
'Check if it's a 1
If Char = "1" Then
'Character is a One
End If
thanks megatron, also thanks for taking so long to respond :) I decided to look at it and see how it works, I got everything to work before your last post, thanks for teaching me
dimava
LIKE, learn to love it
Code:IF text1 Like "[A-Z]#a[a-z]1" then
'Letter is what you want
End if
thanks, but I already did the whole thing using megatrons mega solution
Hey Kedaman, could you explain that just a little. I am somewhat understanding it, or maybe give me a keyword to search in the MSDN help files...anything so I can learn that. It looks almost just like a database query?.?.
Basically it's used to comapre 2 strings. Look up Like Operator for futher information.
[A-Z] means the character can be A, B, C... all the way to Z (Uppercase)
# means a numeric character
[a-z] means the character can be a, b, c... all the way to z. (Lowercase)
a and 1 simply mean the character's a and 1.