首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

救急啦!Dim Buff() As Byte 转为Dim StrA As String如何转

2012-02-09 
大虾救急啦!Dim Buff() As Byte 转为Dim StrA As String怎么转DimBuff()AsByteBuff()有20个字节要转为DimS

大虾救急啦!Dim Buff() As Byte 转为Dim StrA As String怎么转
Dim   Buff()   As   Byte   'Buff()有20个字节
要转为   Dim   StrA   As   String   怎么转

[解决办法]
Private Sub Command1_Click()
Dim Buff() As Byte 'Buff()有20个字节
Dim i As Integer
Dim StrA As String
ReDim Buff(19)
For i = 0 To 19
Buff(i) = i + 48
Next
For i = 0 To 19
StrA = StrA & Chr(Buff(i))
Next
Text1 = StrA
End Sub

[解决办法]
StrA = Buff 就可以,StrA 的编码格式取决于 Buff
[解决办法]
StrA = Buff
[解决办法]
上楼的兄弟说得对,直接赋值就可以了,只是最好还是使用StrConv函数
StrA = StrConv(Buff, vbFromUnicode)
或者是
StrA = StrConv(Buff, vbUnicode)
[解决办法]
Private Sub Command1_Click()
Dim i As Integer
Dim intA(20) As Byte
For i = 0 To 20
intA(i) = 65 + i
Next
Dim strA As String
strA = StrConv(intA, vbUnicode)
End Sub

[解决办法]
Private Sub Form_Click()
Dim i As Integer
Dim bta(19) As Byte
For i = 0 To 19
bta(i) = i + 49
Next
Dim strA As String
strA = StrConv(bta, vbUnicode)
Print strA
End Sub
[解决办法]
StrConv()函数
[解决办法]
StrA = StrConv(Buff, vbFromUnicode)

热点排行