Solved

Converting byte array to String

Posted on 2001-06-13
4
316 Views
Last Modified: 2010-05-02
I have a byte array that represents a string.  How do I convert it to a variable length String
0
Comment
Question by:c095276
  • 2
4 Comments
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
Comment Utility
you can simply assign it to a string variable.

dim bytArray() as byte
dim strData as string

'i assume that the bytArray variable is actually filled with data...

strData = bytArray

Cheers
0
 
LVL 22

Accepted Solution

by:
CJ_S earned 20 total points
Comment Utility
Dim b() as Byte, Str as string

...

Str = StrConv(b, vbUniCode)

0
 
LVL 15

Expert Comment

by:ameba
Comment Utility
It depends on what is in your byte array:

Private Sub Form_Click()
    Dim bytArray() As Byte
    Dim strData As String
   
    strData = "AAA"
    bytArray = StrConv(strData, vbFromUnicode)
    MsgBox "UBound(bytArray) = " & UBound(bytArray)
    strData = StrConv(bytArray, vbUnicode)
    MsgBox strData
   
    strData = "AAA"
    bytArray = strData
    MsgBox "UBound(bytArray) = " & UBound(bytArray)
    strData = bytArray
    MsgBox strData
End Sub
0
 
LVL 22

Expert Comment

by:CJ_S
Comment Utility
Glad to be of service!

regards,
CJ
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
VB6 convert MSHFlexgrid1 cells no2 2 50
VB6 add a minute to the date time value 8 44
Excel - Save a copy of work book 13 79
Copy a row 12 52
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now