VB中数据类型转换中的问题 提示实时错误6 溢出?
用VB做上位机软件时,如何将下位传给我的字符串(3F 8E 14 7B)转换成浮点数 1.11
Option Explicit
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Dim s As String
s = "3F 8E 14 7B"
Dim buff(3) As Byte
Dim a() As String
a = Split(s, " ")
Dim i As Long
For i = UBound(a) To 0 Step -1
buff(3 - i) = Val("&H" + a(i))
Next
Dim J As Single
CopyMemory J, buff(0), 4
Text1.Text=CStr(J)
麻烦GGJJ们看看,希望尽快看到回复。不胜感激
补充:VB , API