workaround for CCur from string

Please report bugs

workaround for CCur from string

Postby berndnoetscher » Wed Sep 14, 2011 9:03 am

Just found a bug in CCur. Here is the workaround.

Function myCCur(s As String)
Dim d As Double = CDbl(s)
Dim c As Currency = d
c = c - Int(d) * 2
Return c
End Function


betrag = myCCur("9931.2349")
berndnoetscher
Site Admin
 
Posts: 1059
Joined: Tue Sep 25, 2007 9:37 am

Re: workaround for CCur from string

Postby berndnoetscher » Wed Sep 14, 2011 5:05 pm

berndnoetscher wrote:Just found a bug in CCur. Here is the workaround.

Function myCCur(s As String)
Dim d As Double = CDbl(s)
Dim c As Currency = d
c = c - Int(d) * 2
Return c
End Function


betrag = myCCur("9931.2349")


Update:
Code: Select all
Function myCCur(s As String)
  Dim d As Double = CDbl(s)
  Dim c As Currency = d
  if d < 0 then
  else
    c = c - Int(d) * 2
  end if
  Return c
End Function
berndnoetscher
Site Admin
 
Posts: 1059
Joined: Tue Sep 25, 2007 9:37 am


Return to Bug-Reports

cron