VB6には次のようなコードがあります:
IsLast = Abs(CursorPos = Len(numText.Text))
false を 0 に、true を 1 に評価するもの。
このコード行により、VB.NET でエラーが発生します。
これを正しく書く方法は?
編集: エラーは次のとおりです。
Error 15 Overload resolution failed because no accessible 'Abs' can be called without a narrowing conversion:
'Public Shared Function Abs(value As Decimal) As Decimal': Argument matching parameter 'value' narrows from 'Boolean' to 'Decimal'.
'Public Shared Function Abs(value As Double) As Double': Argument matching parameter 'value' narrows from 'Boolean' to 'Double'.
'Public Shared Function Abs(value As Single) As Single': Argument matching parameter 'value' narrows from 'Boolean' to 'Single'.
'Public Shared Function Abs(value As Long) As Long': Argument matching parameter 'value' narrows from 'Boolean' to 'Long'.
'Public Shared Function Abs(value As Integer) As Integer': Argument matching parameter 'value' narrows from 'Boolean' to 'Integer'.
'Public Shared Function Abs(value As Short) As Short': Argument matching parameter 'value' narrows from 'Boolean' to 'Short'.
'Public Shared Function Abs(value As SByte) As SByte': Argument matching parameter 'value' narrows from 'Boolean' to 'SByte'.