0

hi,
i am very new to vb.net and just started learning from the sources on Internet. i m trying to create a base64 coded password but i m stuck on one of its lines.

I applied MD5 code to password then I want to apply base64 to password.

Dim MD5Hash As String = getMD5Hash(txtPassword.Text)

    Dim byt As Byte() = System.Text.Encoding.UTF8.GetBytes(txtPassword.Text)

    Dim base64 As String = Convert.ToBase64String(byt)

    ' convert the byte array to a Base64 string
    [B]base64 [/B]= Convert.ToBase64String(byt)

this gave me a "Declaration expected" error for base64

What do I have to? How can I fix it?

Edited by kaanay: n/a

2
Contributors
1
Reply
3
Views
6 Years
Discussion Span
Last Post by __avd
0

This statement base64 = Convert.ToBase64String(byt) is placed outside the block/procedures. (Only declarations are allowed outside procedures.)

Sub Test()
        Dim byt As Byte() = System.Text.Encoding.UTF8.GetBytes("hello")

        Dim base64 As String = Convert.ToBase64String(byt)

        ' convert the byte array to a Base64 string
        base64 = Convert.ToBase64String(byt)
    End Sub

Edited by __avd: typo.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.