类型不匹配的问题
本帖最后由 bcrun 于 2013-02-02 19:02:17 编辑
Private Sub Form_Load()
Dim JiaoYanHe As Long
Dim aa As Long
JiaoYanHe = Val("&h" & "4a") + Val("&h" & "4b")
Label1.Caption = Hex(JiaoYanHe) And &HFF
aa = Val("&h" & "4a")
Debug.Print Hex(aa)
Label2.Caption = Hex(aa) And &HFF
End Sub
Private Sub Form_Load()
Dim JiaoYanHe As Long
Dim aa As Long
JiaoYanHe = Val("&h" & "4a") + Val("&h" & "4b")
Label1.Caption = Hex(JiaoYanHe) And &HFF
aa = Val("&h" & "4a")
Debug.Print Hex(aa)
Label2.Caption = aa And &HFF ' 试试这样,hex(aa)返回的是字符串"4A",不能参加与运算(AND)。
End Sub