Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27514

vb 2012 convertall?

$
0
0
So I was trying to translate this code from vb 2008 to vb 2012 and I found some surprises...

Dim text As String = u
Dim bytes As Byte() = Encoding.ASCII.GetBytes(text)


Dim hex As String() = Array.ConvertAll(bytes, Function(b) b.ToString("X2"))
Dim output As String = String.Join(String.Empty, hex)

There is no Encoding.ASCII in vb 2012, I replaced that to

Dim bytes As Byte() = Encoding.UTF8.GetBytes(text)

But I have no idea how do I convert the bytes to a string? there is no convertAll function in vb2012... The main idea is converting any text value entered in textboxt1 to it hexadecimal value and display it in a textblock1 (or label but there are no labels in vb2012). Same thing that this online tool http://www.swingnote.com/tools/texttohex.php can do.

Viewing all articles
Browse latest Browse all 27514

Trending Articles



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