VB 十六进制浮点型数据转换函数 真的很奇怪 望各位高人、老鸟、前辈们指教,谢谢!!!
十六进制四字节浮点型数据转换函数如下:操作没有问题
Option Explicit
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Dim F As Single
Dim A(3) As Bye
Private Sub Command1_Click()
A(0) = CLng("&H" & Text1.Text)
A(1) = CLng("&H" & Text2.Text)
A(2) = CLng("&H" & Text3.Text)
A(3) = CLng("&H" & Text4.Text)
CopyMemory F, A(0), 4
Text5.Text = F
End Sub
但是 我在变量声明里加了一句“dim b as string”问题来了
就会老是出现“Type Miss”、“类型不匹配”的系统错误提示
而且即使我把“dim b as string”这句删除,程序还是会一直报上面的错误,除非重启程序。
出错代码如下:
Option Explicit
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Dim F As Single
Dim A(3) As Bye
DIM B AS String
Private Sub Command1_Click()
A(0) = CLng("&H" & Text1.Text)
A(1) = CLng("&H" & Text2.Text)
A(2) = CLng("&H" & Text3.Text)
A(3) = CLng("&H" & Text4.Text)
CopyMemory F, A(0), 4
Text5.Text = F
End Sub
真的很奇怪,希望各位大哥、高手、老鸟、前辈指教!!!小弟先谢谢了!!!! --------------------编程问答-------------------- 楼主的代码让我范晕,这个代码能运行??? --------------------编程问答-------------------- http://blog.csdn.net/zdingyun/article/details/2528026 --------------------编程问答-------------------- Dim A(3) As Bye ---->Dim A(3) As Byte --------------------编程问答-------------------- 麻烦lz是否先确认下以下2个问题:
1、Dim A(3) As Bye 是不是类型声明有点问题
2、A(0) = CLng("&H" & Text1.Text) 转换的结果是Long类型
补充:VB , 非技术类