Foxtable(狐表)用户栏目专家坐堂 → HexToDec未声明名称的处理


  共有3471人关注过本帖树形打印复制链接

主题:HexToDec未声明名称的处理

帅哥哟,离线,有人找我吗?
wangjh8888
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:502 积分:4924 威望:0 精华:0 注册:2016/7/11 10:12:00
HexToDec未声明名称的处理  发帖心情 Post By:2020/3/18 14:22:00 [显示全部帖子]

老师  好
Dim s As String = "7b"
Dim d As Integer =HexToDec(s)
上面代码在命令窗口可以执行,在全局代码就提示HexToDec未声明名称,怎么办?

 回到顶部
帅哥哟,离线,有人找我吗?
wangjh8888
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:502 积分:4924 威望:0 精华:0 注册:2016/7/11 10:12:00
  发帖心情 Post By:2020/3/18 14:52:00 [显示全部帖子]

老师 是不是在内部函数  增加这个函数吗   ( HexToDec )

 回到顶部
帅哥哟,离线,有人找我吗?
wangjh8888
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:502 积分:4924 威望:0 精华:0 注册:2016/7/11 10:12:00
  发帖心情 Post By:2020/3/18 15:07:00 [显示全部帖子]

老师, 内部函数还不会使用,教教我。以下是我要的函数,应该怎么写在内部函数?  谢谢
Public Function Make_我要的GPS数据(GPSstr As String) As Boolean
Dim result As Boolean
Dim S As String = GPSstr.trim()
Dim n1 As Integer = S.IndexOf("$")+1
Dim n2 As Integer = S.LastIndexOf("*")-1
Dim SR As String = S.SubString(S.LastIndexOf("*")+1)
S = S.SubString(n1,n2-n1+1)
Dim cs(s.length-1) As String
For i As Integer = 0 To s.length-1
    cs(i) = S.SubString(i,1)
Next
Dim RR As Integer = ASC(cs(0))
For i As Integer = 1 To s.length-1
    RR=RR  xor ASC(cs(i))
Next

If RR = HexToDec(SR) Then
    result =True
Else
    result =False
End If

Return result 
End Function

 回到顶部
帅哥哟,离线,有人找我吗?
wangjh8888
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:二尾狐 帖子:502 积分:4924 威望:0 精华:0 注册:2016/7/11 10:12:00
  发帖心情 Post By:2020/3/18 17:44:00 [显示全部帖子]

老师  下面代码,校验通过时,出错提示啊,快帮看看问题在哪里啊,谢谢,谢谢
内部函数:GPS校验
Dim GPSstr As String = args(0)
Dim result As Boolean
Dim S As String = GPSstr.trim()
Dim n1 As Integer = S.IndexOf("$")+1
Dim n2 As Integer = S.LastIndexOf("*")-1
Dim SR As String = S.SubString(S.LastIndexOf("*")+1)
S = S.SubString(n1,n2-n1+1)
Dim cs(s.length-1) As String
For i As Integer = 0 To s.length-1
    cs(i) = S.SubString(i,1)
Next
Dim RR As Integer = ASC(cs(0))
For i As Integer = 1 To s.length-1
    RR=RR  xor ASC(cs(i))
Next

If RR = HexToDec(SR) Then
    result =True
Else
    result =False
End If
Return result

全局代码:
Public datetime_GPRMC As Date
Public jd_GPRMC As Double
Public jb_GPRMC As String
Public wd_GPRMC As Double
Public wb_GPRMC As String

Public Function Make_我要的GPS数据(GPSstr As String) As Boolean
Dim result As Boolean= Functions.Execute("GPS校验",GPSstr)
If result Then
    Dim cs() As String = GPSstr.Trim().Split(",")  ''每列   ***  rs(i).Trim().
    '' ------------------ Longdatetimestr 2020-03-13 09:54:46
    Dim yyyy As String ="20" & cs(9).SubString(4,2)
    Dim yy As String =cs(9).SubString(2,2)
    Dim dd As String =cs(9).SubString(0,2)
    Dim hh As String =cs(1).SubString(0,2)
    Dim mm As String =cs(1).SubString(2,2)
    Dim ss As String =cs(1).SubString(4)
    datetime_GPRMC = Cdate(yyyy & "-" & yy & "-" & dd & " " & hh & ":" & mm & ":" & ss)
    '' ------------------ jd  118.1085966666    24.4887866666
    jd_GPRMC = GPSStrToVal(cs(5).trim())
    jb_GPRMC = cs(6).trim()
    wd_GPRMC = GPSStrToVal(cs(3).trim())
    wb_GPRMC = cs(4).trim()
End If
Return result
End Function

命令窗口:
Dim GPSstr As String ="$GPVTG,89.68,T,,M,0.00,N,0.0,K*5F"
Dim b As Boolean =Make_我要的GPS数据(GPSstr)
msgbox(b)


不好意思  找到问题了  我的错误,打搅了!!
[此贴子已经被作者于2020/3/18 17:51:38编辑过]

 回到顶部