5
I am doing a project in Visual Basic but when the user type a string that will be 5 the maximum ex: UF052 I want to do a if
where it will be compared.
If textbox1 = "UF052" the
Comando
End if
However I do not want to compare all the characters but only the 52 could be UG152 that would still fall in the true
.
It could improve the condition by going to
InStr()
to position where you want to start the search (in this case the last two digits of thestring
).– Omni
yes, if his string always comes "UF052" he can impose the position. Example: Instr(Right("UF052", 2), "52")
– Wellington Araujo
According to the OP, he always wants to check the last two characters of
string
hence my suggestion. In this case it is not problematic because, according to the OP, thestring
has a maximum of 5 characters, so the impact on performance is minimal.– Omni
I changed my comment...
– Wellington Araujo
yes, in fact the UF will always have this value I will set UF already at the beginning the user will type only for example 654 or other value, I can do with variables tbm? , because I will not know which value q the user will type, will have a textbox2 that will appear these UF*** at a certain time then when arriving this UF*** equal to the user would enter true.
– lxxtomxxl
You have Ixxtomxxi, instead of the string you put a string type variable.
– Wellington Araujo