Im trying to split a string placed in a text box and place it in an array so then I can check to see if it is a valid postal code L#L-#L#. If someone can help meout id really appreciate it thanks.
Yes you can use the split function in VB <br><br>eg to split the string mentioned above <br><br>dim myArray() as string <br><br>MyArray = split(text1.text,"-"<br><br>'This will create two elements inthe array <br><br>myArray(0) = L#L<br>myArray(1) = #L#<br><br>Hope this is what you were looking for <br><br>
actually I want to take each letter or number and place them into the array such as<br> myarray(0) = L<br> myarray(1) = #<br> myarray(2) = L<br> ETC..
dim myArray(Len(text1.text))<br>dim i as integer<br><br>for i = 1 to len(text1.text)<br> myArray(i-1) = mid(text1.text,i,1)<br>next i <p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href=
use the like statement <br><br><br>if ucase(myArray(x)) Like "[A-Z]" then <br> msgbox "Letter"<br>elseif myarray(x) Like "[0-9]" then<br> msgbox "Number"<br>end if <br><br><br>For more help check out MSDN on Like operator <br><br>Hope this helps <br><br><br>
<br>You can also use the IsNumeric function<br><br>If IsNumeric(myvar) Then<br> Msgbox "Numeric data"<br>Else<br> Msgbox "Alpha data"<br>End If<br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.