Question: How do I convert a string from a textbox into hexadecimal?

I have only found ways in C#. Does VB.NET have the ability to do such a thing? If it can then I'd like to know how to convert string to hex and hex to string.

Answer: 
```
Dim val As String
val = "10"
Dim hexVal As Integer
hexVal = Convert.ToInt32(val, 16) //16 specifies the base
Console.WriteLine(hexVal)

```

This will display 16 which is the integer equivalent of the hexadecimal string "10".
**Tried and tested code**

Create this function by copy pasting it.

```
Function StringToHex(ByVal text As String) As String
    Dim hex As String
    For i As Integer = 0 To text.Length - 1
        hex &= Asc(text.Substring(i, 1)).ToString("x").ToUpper
    Next
    Return hex
End Function

```

Use it like this

```
Debug.WriteLine(StringToHex("sim0n"))

```

[Source](https://sim0n.wordpress.com/2009/03/28/vbnet-string-to-hex-conversion/)