trend Posted August 21, 2005 Posted August 21, 2005 (edited) I am creating an Array like this: Dim UserPass As String() = s.Split(New Char() {":"}) And I know there is atleast 2 values in the array: Dim username As String = UserPass(0) Dim password As String = UserPass(1) But sometimes there will be 3 or 4 values.. Dim username As String = UserPass(0) Dim password As String = UserPass(1) Dim somethingelse As String = UserPass(2) Dim somethingelse3 As String = UserPass(3) I will not know if it will be 2,3, or 4 values.. How can I do the above (do I haveto use a try,catch?) thanks Lee Edited November 26, 2005 by PlausiblyDamp Quote
IceAzul Posted August 21, 2005 Posted August 21, 2005 Check the length of array using UserPass.Length() in If statements. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.