Foxtable(狐表)用户栏目专家坐堂 → 求助 全局代码


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

主题:求助 全局代码

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/6/3 12:53:00 [显示全部帖子]

封装成一个方法调用,如

 

http://www.foxtable.com/webhelp/scr/1938.htm

 


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2018/6/3 17:56:00 [显示全部帖子]

Public Function convertcm(amcm As String, value As DataRow) As Decimal
Dim cmovrnd As Decimal

If amcm.Contains(" ") = False AndAlso amcm.Contains("/") Then
   
    Dim slam() As String = amcm.split("/")
   
    Dim ihcam As Decimal = CSng(slam(0))
   
    Dim ihdam As Decimal = CSng(slam(1))
   
    Dim ihaam As Decimal = ihcam / ihdam
   
    cmovrnd = Format(Eval(ihaam * 2.54,value),"###0.###")
   
Else
   
    Dim sam() As String = amcm.split(" ")
   
    Dim iham As Decimal = CDec(sam(0))
   
    If sam.Length = 1 Then
       
        cmovrnd = Format(Eval(iham * 2.54,value),"###0.###")
       
    Else
       
        Dim slam() As String = sam(1).split("/")
       
        Dim ihcam As Decimal = CSng(slam(0))
       
        Dim ihdam As Decimal = CSng(slam(1))
       
        Dim ihaam As Decimal = ihcam / ihdam
       
        cmovrnd = Format(Eval((iham + ihaam) * 2.54,value),"###0.###")
       
    End If
   
End If
return cmovrnd
end function

 

调用

 

dim cmovrnd = convertcm(“123”, Tables("表A").current.DataRow)
msgbox(cmovrnd)


 回到顶部