Quantcast
Viewing all articles
Browse latest Browse all 27071

VS 2010 String to Char error

Hi Guys,

I have a problem in one of my functions:

Code:

        '// FIRST THING IS TO SEPERATE AND SORT THE STRINGS
        Dim credentialsSplit As String() = urlLogin.Split(Convert.ToChar(" "))

        '// DECLARE VARIABLES USED
        Dim credentialsURL As String = credentialsSplit(0)
        Dim credentialsUSR As String = credentialsSplit(1)
        Dim credentialsPWD As String = credentialsSplit(2)

        '// CLEAN UP THE USER AND PASS FIELDS
        Dim credUSRCleaned As String() = credentialsUSR.Split(Convert.ToChar("U:"))
        Dim credPWDCleaned As String() = credentialsPWD.Split(Convert.ToChar("P:"))

        '// FINAL VARIABLES
        Dim USER As String = credUSRCleaned(1)
        Dim PASS As String = credPWDCleaned(1)

I don't get any errors when i type the code above only when debugging it shows:

Dim credUSRCleaned As String() = credentialsUSR.Split(Convert.ToChar("U:")) <-- String must be exactly one character long.

If i take away the "(Convert.ToChar" on the lines i then get: Option Strict On disallows implicit conversions from 'String' to 'Char'.

I have looked up the error but i'm still not sure on the fix, any help would be appreciated :)

cheers guys

Graham

Viewing all articles
Browse latest Browse all 27071

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>