Public amcm As String
Public cmovrnd As Decimal
If amcm.Contains(" ")
= False AndAlso
amcm.Contains("/") Then
Public slam() As String = amcm.split("/")
Public ihcam As Decimal = CSng(slam(0))
Public ihdam As Decimal = CSng(slam(1))
Public ihaam As Decimal = ihcam / ihdam
cmovrnd = Format(Eval(ihaam * 2.54,e.DataRow),"###0.###")
Else
Public sam() As String = amcm.split(" ")
Public iham As Decimal = CDec(sam(0))
If sam.Length = 1 Then
cmovrnd = Format(Eval(iham * 2.54,e.DataRow),"###0.###")
Else
Public slam() As String = sam(1).split("/")
Public ihcam As Decimal = CSng(slam(0))
Public ihdam As Decimal = CSng(slam(1))
Public ihaam As Decimal = ihcam / ihdam
cmovrnd = Format(Eval((iham + ihaam) * 2.54,e.DataRow),"###0.###")
End If
End If
厘米转英吋
表事件DataColChanging代码:如下:
Public cmam As Decimal
Public
amovrnd As String
z
= cmam
If z
> "" Then
Dim s()
As String = z.split(".")
If s.Length = 1 Then
amovrnd = (s(0))
Else
Dim i As Long = CInt(s(1))
Dim j As Long = 10 ^ s(1).Length
Dim k = j *1000 / 16
Dim l = i*1000\k
If l = 0 Then
amovrnd = (s(0))
Else
Dim m = l / 16
Dim d As Decimal = m
Dim sl() As String = d.ToString().split(".")
If sl.Length = 1 Then
amovrnd = (sl(0))
Else
Dim b As Long = CInt(sl(1))
Dim a As Long = 10 ^ sl(1).Length
Dim c As Long = a Mod b
Dim x = a
Dim y = b
Do While c <> 0
a=b
b=c
c = a Mod b
Loop
Dim r As String
If (s(0)) = 0 Then
r = y/b
& "/" & x/b
Else
r =
s(0) &" " & y/b & "/" & x/b
End If
amovrnd = (r)
End If
End If
End If
End If
End
Select
Select
Case e.DataCol.name
Case "siudamkf"
Dim z As String
z = e.NewValue
If z > "" Then
Dim s() As String = z.split(".")
If s.Length = 1 Then
e.NewValue = (s(0))
Else
Dim i As Long = CInt(s(1))
Dim j As Long = 10 ^ s(1).Length
Dim k = j *1000 / 16
Dim l = i*1000\k
If l = 0 Then
e.NewValue = (s(0))
Else
Dim m As String = l
/ 32
Dim d As Decimal =
m
Dim sl() As String
= d.ToString().split(".")
If sl.Length = 1 Then
e.NewValue =
(sl(0))
Else
Dim b As Long =
CInt(sl(1))
Dim a As
Long = 10 ^ sl(1).Length
Dim c As
Long = a Mod b
Dim x = a
Dim y = b
Do While c
<> 0
a=b
b=c
c = a Mod b
Loop
Dim r As String
If (s(0)) =
0 Then
r = y/b & "/" & x/b
Else
r = s(0)
&" " & y/b & "/" & x/b
End If
e.NewValue =
(r)
End If
End If
End If
End If
End
Select
End If
请老师指教!
谢谢老师!!!