Private Sub Command1_Click()
Dim ascii(127) As String
Dim i As Integer
For i = 0 To 127
ascii(i) = Chr(i)
Print i, ascii(i)
Next
End Sub
你的观点应该没错,已将代码修改如下,这129可能是代码码错所致。:
Option Explicit
Private Sub Command1_Click() '
Dim bytTmp(0 To 1) As Byte
Dim strSj As String
Dim strHexSj As String
Dim i As Long
Dim bytSj() As Byte
strSj = "123ABC十六进制, 其中引用了您的一段代码"
Text1 = strSj
bytSj = StrConv(strSj, vbFromUnicode)
For i = 0 To UBound(bytSj)
strHexSj = strHexSj & Right("0" & Hex(bytSj(i)), 2)
Next
DebugPrint strHexSj
For i = 0 To UBound(bytSj) - 1
If bytSj(i) = 0 Then Exit For
If bytSj(i) > 31 And bytSj(i) <= 127 Then
MetxtSound = MetxtSound & Chr(bytSj(i))
Else
bytTmp(0) = bytSj(i)
bytTmp(1) = bytSj(i + 1)
i = i + 1
MetxtSound = MetxtSound & StrConv(bytTmp, vbUnicode)
End If
Next i
End Sub
Private Sub Form_Load()
txtSound = ""
End Sub
bytSj(i) > 31 And bytSj(i) <= 127,本句范围内显示可显示ASCII字符。ASCII码为0,则往后字符串不显示。1-31是不能显示控制符,32是空格符。
Else句后是为汉字字符拼接用,每个汉字占16位,转为两个Byte数据。
Private Sub Text1_KeyPress(KeyAscii As Integer)
a = KeyAscii
b = Asc(Hex(Val(Chr(a))))
If a > 48 And a < 58 Then
Text2Text = Text2Text & b
Else
Text2Text = Text2Text & a
End If
End Sub
1---9转化成16进制还是1---9
你用电脑自带的计算器算一下,开始我也以为错了
不会吧,你算一下Asc(Hex(1))和Asc(1)是一样的,你再把1换成2-----9都一样啊
以上就是关于如何用vb做ascii码表全部的内容,包括:如何用vb做ascii码表、看到一段VB 十六进制转ASCII 的程序,为什么要限定ASCII码 十进制31~129 范围内需要这么限定吗、如何用VB实现ASCII转换等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)