• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    .NET

    Reply
    Distinguished Contributor
    SRSDS
    Posts: 227
    Registered: ‎04-15-2011
    Accepted Solution

    Passing variables.

    155 Views, 4 Replies
    03-15-2012 02:05 PM

    Can someone suggest what is wrong here?

    Diameter is passed in as 12.7 but it is not acceptint it as a true statement.

     

        Function Volume(Diameter As Single)
            If Diameter = 12.7 Then
            end if
        End Function

     

    Please use plain text.
    *Expert Elite*
    arcticad
    Posts: 1,251
    Registered: ‎06-21-2004

    Re: Passing variables.

    03-15-2012 02:25 PM in reply to: SRSDS

        Function Volume(ByVal Diameter As Single) As Boolean
            If Diameter = CSng(12.7) Then
                Return True
            Else
                Return False
            End If
        End Function

    ---------------------------



    “We don’t have a snowball’s chance in a blast furnace of surviving this attack unless every one of our units gets into the fight right now!”
    Please use plain text.
    Distinguished Contributor
    SRSDS
    Posts: 227
    Registered: ‎04-15-2011

    Re: Passing variables.

    03-15-2012 02:44 PM in reply to: arcticad

    Thanks again!!

    Please use plain text.
    Member
    Posts: 5
    Registered: ‎12-14-2009

    Re: Passing variables.

    04-10-2012 03:32 AM in reply to: SRSDS

    I think this will do it too:

     

    If Diameter = 12.7# Then end if

    Please use plain text.
    *Expert Elite*
    Posts: 1,640
    Registered: ‎04-29-2006

    Re: Passing variables.

    04-10-2012 09:33 AM in reply to: sbarlage

    Hi,

     

    Don't make VB more verbose than it is...

     

        Function Volume(ByVal Diameter As Single) As Boolean
            Return Diameter = 12.7F
        End Function

     But why using a Single rather than a Double ?

    Gilles Chanteau
    Please use plain text.