Question Locked

How to write code Convert Byte to String in Vb.net

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi

Plz. Help me
how to write code convert Byte to String in Vb.net

Regards
Sanjay

2 replies

by tony hopkinson

array of bytes is something like
Dim dBytes As Byte() = ...
Dim str As String
Dim enc As New System.Text.ASCIIEncoding()
str = enc.GetString(dBytes)
ASCIIEncoding assumes bytearray each byte is a single character. The default Unicode would assume each byte pair is a single character.

PS be careful about null's (Char(0)).

This discussion is closed to new replies.